- Unix- like system directory Structure
the directory structure of the Linux system is a hierarchical tree structure, which are mounted under the root filesystem "/", and the directory structure of the Linux system is listed below.
Detailed description of common directories in the Linux system directory structure
Directory |
Describe |
/home |
The directory contains the home directory for each user on the Linux system, and the subdirectory name is named after the user name |
/root |
The directory is the root user's home directory |
/bin |
This directory contains commonly used command files and cannot contain subdirectories |
/sbin |
This directory contains the command files used by the system administrator and root user |
/dev |
This directory contains most of the device files, such as disks, optical drives, etc. |
/lib |
The directory and subdirectories of this directory contain shared files and kernel module files for Linux Systems |
/lib64 |
The directory and its subdirectories contain shared files and kernel module files for the version Linux system |
/tmp |
This directory contains some temporary files |
/mnt |
This directory provides a default mount directory for some devices ( hard disk ) mounts |
/boot |
The directory contains kernel files and boot loader ( such as GRUB) files for Linux Systems |
/opt |
This directory contains installation files for some third-party applications |
/media |
This directory provides a default mount directory for devices such as discs, floppy disks, andU disks. |
/var |
This directory stores infrequently changing data, such as system logs, print queues,DNS database files, etc. |
/misc |
This directory is used to indicate the public mount point of the NFS Directory |
/etc |
This directory contains Most of the configuration files on the Linux system and it is recommended that you back up the configuration files before modifying them |
/usr |
This directory contains programs and data that can be used by all users |
/net |
This directory is used to support the mounting of shared directories on other operating systems over the network, such as NFS Shared Directories |
/srv |
This directory contains the data directory to be used after some services have been started. |
/sys |
While the Linux system provides hot-swappable capabilities, the directory contains the detected hardware settings, which are converted to device files in the / dev Directory |
/proc |
The directory is a virtual file system, it does not exist on disk, but has the kernel in memory, to provide information about the system |
/selinux |
The directory is the selinux configuration directory, andselinux ( security enhanced Linux) is a linux A mandatory access control implementation mechanism in the system can enhance The security of Linux system |
/lost+found |
The directory is empty in most cases. If there is a sudden power outage at work, or if you are not shutting down normally, some files will not be found when restarting the computer, and for these files, theLinux system places them in this directory . |
located in /home/usr, called user working directory or home directory
Presentation mode:
/home/usr~
User can control the degree of access to a given file or directory, a file or directory may have read, write, and Execute permissions
- Read Permissions (r) for a file, have permission to read the contents of the file, and for the directory to have the Browse directory permission
- Write Permissions (W) for the file, has the new, modifies the file content the permission, to the directory, has the deletion, moves the file inside the directory the permission
- Executable Permissions (x) for a file, have permission to execute the file, and the user has permission to enter the directory for the directory
Note: usually The Unix/linux system allows only the owner or Superuser of the file to change the file's read and Write permissions
Example Description:
The first letter represents the type of file : "D" represents a folder,"-" represents a normal file,"C" represents a hardware character device,"B" represents a hardware device,"s" Represents a pipeline file, and"L" represents a soft connection file. The following 9 letters represent three groups of permissions: The file owner, the user group, and other users.
Each user has its own read, write, and Execute permissions:
- the first set of permissions Controls access to their own file permissions, and Owner permissions
- The second set of permissions controls the permissions of the user to access the files of one of the users who are in the same group
- The third set of permissions controls the permissions of other users to access a user's files
These three sets of permissions give the user different types ( i.e. owner, user group and other users ) ability to read, write and execute
- Operation of the Directory
Additions and copies of catalogs
Directory New command:mkdir
Create one or more new empty directories
Common Options Parameters "-P" for recursive creation of multi -level catalogs
copy of directory command:CP
Copy the source directory to the target directory, supporting the simultaneous renaming of the copy
common option Parameter "-a" for all copies
common option parameter "-F" for Force copying
Deletion of directories
Empty Directory Delete command:rmdir
Delete one or more empty directories
common option Parameter "-P" for recursive deletion of multi-layered empty directories
non-empty directory Delete command:RM-RF
Recursive deletion of non-empty directories
common option Parameter "-r" for recursive deletion
common option parameter "-F" for Force removal
Moving and renaming of directories
Directory Move renaming command:MV
Moving the directory Renaming of directories Renaming of directory moves at the same time
For example:
MV a b # change A to BMV C b/A # move C to the B directory MV D b/C # move D to B Change to C in the directory
The third lesson of Linux Learning--linux directory