In this blog post, I will organize the commonly used directories and command functions in Linux systems (multi-user systems, where two or more users can log in to the computer at the same time).
1. Directory
1. /boot System kernel and files used for booting
2. /bin command, you can execute the location where the program is stored
3. The configuration file of the /etc system (modifying the parameters will affect the behavior and produce new features)
4. /dev device file storage location (software and hardware resources are regarded as files)
5. /home Ordinary user home directory
6. /lib library file storage location (divided into: shared library and static library)
7. /mnt temporary mount point (mount directory)
8. /root administrator home directory
9. /proc virtual directory, the information of the process in the memory is mapped to this directory (virtual file, the information in the memory, the number is the number of the process)
10. /usr Places shareable content that changes infrequently, such as software installed by default in the system
11. /var files that change frequently, such as email content, login files
12. /tmp temporary file
13. /lost+found files recovered during filesystem repair
2. Command
1. cd switch directory switch path (absolute path relative path <with the current location as the reference point>)
cd / to change to the root directory
cd - go back to the directory before the switch (the last two places to switch)
cd .. go back to the previous level
2. pwd displays the current directory, that is, the current location in the directory tree
3. ls View files and directories, and display which files are in the current directory by default
ls -l displays detailed information about files in the current directory
ls /bin shows which files are in the /bin directory
(Linux system file type)
- normal file
d directory file
l link file
p pipe file
c,b device file
4. touch creates a normal file
Example: touch file.txt
5. mkdir creates a directory file (folder)
Example: mkdir tmp
6. rmdir delete empty directory
Example: rmdir tmp
7.cp copy file
Example: copy common file cp ac bc
Copy directory files cp -r tmp dir
cp source file path (can be omitted) + name target file path + name (there are two cases:
<1> The path name is omitted: that is, the system will give a new name to the target file after copying
<2> The path does not save the name: copy the source file to the current path)
8. rm delete file
Example: delete common files rm ac
Delete directory files <1> rm -r (with an argument) dir
<2> rmdir dir (empty folder) This command can only be used to delete empty folders
Note: If you don’t have write permission, you cannot delete it. The system will prompt you if you want to delete it. If you want to delete it, enter y (yes), otherwise enter n (no)
9. mv move file/rename
Example: Rename normal file mv file.txt test.txt
rename directory file mv tmp dir
move files mv ac dir
10.clear clear screen
3. File permissions
Authority Text setting method Number setting method
Read permission r 4
write permission w 2
Execute permission x 1
No permission - 0
Change file permissions: chmod
1. Text setting method: u means the owner g the same group o other people a everyone + increase permission - remove permission
Example: chmod u+x file
chmod g-w file
2. Digital setting method
Example: chmod 644 file
4. Other
Hidden files starting with "." are invisible to ls by default and visible to ls -a
ls -l shows file details ll is equivalent
Analyze the following file details:
The above is the entire content of this blog post, and colleagues are welcome to correct me.