Linux:Files and directories
Directories
Kivonat: ls ~ (*, ? []), pwd, tree, cd, mkdir, rmdir, rm, mv, mc
- Which directory is the current one?
- Move to the root directory!
- Go to your home directory!
- Move to the system administrator's home directory (it couldn't be success because you don't have permission for it)!
- Move to the etc directory (it opens from the root dir)!
- Move one level up!
- Show the content of the current directory!
- Show the content of /etc and /var/log directories with one command (with details)!
- Move to your home directory! Create a new directory with name Test!
- With one command, create two directories from the Test dir, their name should be T1 and T2!
- Draw the directory structure with the tree command! (Use it later for check yourself!)
- With one command create 3 directories from the Test dir: Unix/Linux/Debian néven!
- Rename the Debian directory to Deb!
- Move the Deb directory to the T1!
- Destroy the T1 directory!
- With one command, remove the Test directory!
- Show the content of the current directory!
- Show the content of the /etc directory with details!
- Show the files with conf extension in the /etc directory!
- Show files in the /etc directory which start with letter p!
- Show the files in the /etc which last character is f!
- Find a file in /etc which starts letter p, the its third character is s and last character is d!
- Show the content of your home directory with all hidden files!
- Show files in the /etc directory which have a or n character in their second position!
- Show all files in the /etc directory which have no a or n in their second position!
- Show all files in the filesystem (it runs for a long time, you can stop it by pressing CTRL-C)!
- Run the Midnight Commaner!
- If you want try to solve all tasks above with the Commander!
File handling
Kivonat: touch, cp, mv, rm, cat, file, TODO: touch.
Exercise | |--Letter | | | |--test | | |---unix | | | |--Linux | |--Check |--Tmp
- Create this directory structure!
- Move to the /etc directory! Show all directories opened from here with the tree command! (Do not show files!)
- Copy the passwd file from the /etc to the Letter directory!
- Copy the shadow file from the /etc to the test dir!
- Copy all files with conf extension from the /etc to the Linux directory!
- Copy all files from the /etc which has a in second, s in the fourth position and its last character is d to the Check directory!
- Move the full content of the Test to the Linux!
- Create a new file in the Check directory with name Data.txt!
- Delete all files from the Linux directory!
- Remove the Letter dir!
- Show the content of the /etc/passwd file!
- What kind of content do these files have: /bin/bash, /etc/passwd, /var/log/syslog!
Linkek
Kivonat: ln, readlink
- Create again the Letter directory and copy the /etc/passwd file into it!
- Check the number of links of the passwd file in the Letter dir! Create a new hardlink to that with name Hozzon létre egy hardlinket erre a fájlra passwordFile! Show the content of the passwordFile! How did the number of links chaged?
- Remove the passwd file in the Letter dir! Check the number of links! Are you able to show the content of the passwordFile?
- Rename the passwordFile to passwd-re! Create a softlink which points to this file with name softLinkFile.txt!
- How long is that file? Why?
- Show the content of the softLinkFile.txt file!
- Show the content of this directory! How can you recognise it was a softlink?