Structure of tree-like directory
The Linux file system is an inverted, single-rooted, tree-like structure. The root of the file system is "/"; file names are strictly case-sensitive; the path is split with "/" (using "\" in Windows).
The tree-like chart is as follows (from the Novice tutorial):
The following is an explanation of the various directories in the list (referenced from the Novice tutorial, slightly modified):
Directory |
Describe |
/bin |
Binary abbreviation, this directory holds the most frequently used commands |
/boot |
Contains some core files for Linux startup, including some connection files and image files |
/dev |
device abbreviation, storage of Linux external devices, access to devices in Linux and access to the file is the same way |
/etc |
Stores all the configuration files and subdirectories required for system administration |
/home |
User home directory. In Linux, each user has a directory of their own, which is typically named after the user's account name |
/lib |
Store the system's most basic dynamic connection shared library, which acts like a Windows-based DLL file. These shared libraries are required for almost all applications |
/lost+found |
Normally empty, when the system is shut down illegally, some files are stored here |
/media |
Some devices are automatically recognized by the Linux system. For example, USB flash drive, optical drive, etc., when identified, Linux will attach the identified device to this directory |
/mnt |
A directory that lets users temporarily mount other file systems. We can mount the optical drive on the/mnt/and then enter the directory to see what's in the CD-ROM. |
/opt |
A directory for the host to install additional software. For example, you can install an Oracle database in this directory. Default is empty |
/proc |
The virtual directory, which is a mapping of system memory, can be accessed directly by accessing the directory for System information. The contents of this directory in memory, you can directly modify some of the files inside. For example, you can use the following command to block the host's ping command, so that others cannot ping your machine: echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_all |
/root |
User home directory for system administrator |
/sbin |
S is the meaning of Super User, which is the system Manager used by the system administrator |
/selinux |
This is a unique directory for Redhat/centos, and SELinux is a security mechanism similar to Windows firewall. However, this is a complex mechanism, this directory is to store the SELinux related files |
/srv |
This directory is the data that needs to be extracted after some services are started |
/sys |
/sys This is a big change in the Linux 2.6 kernel. This directory installs a new file system Sysfs that appears in the 2.6 kernel. The Sysfs file system integrates the following 3 file system information: Proc File system for the process, DEVFS File System for Devices and the Devpts file system for the pseudo-terminal. The file system is a visual reflection of the kernel device tree. When a kernel object is created, the corresponding files and directories are also created in the kernel object subsystem. |
/tmp |
Temp file directory |
/usr |
This directory is very important. Many of the users ' applications and files are placed in this directory, similar to the Program Files directory under Windows |
/usr/bin |
Applications used by system users |
/usr/sbin |
More advanced hypervisor and system daemons used by super users |
/usr/src |
Default drop location for kernel source code |
/var |
This directory is stocked with things that are constantly expanding, and we are accustomed to placing directories that are often modified in this directory. Include log files |
Second, the current working directory
- Each Shell or system process has a current working directory.
- Use the pwd command to display the current working directory.
Iii. Name of the file
- File name is case sensitive.
- A name can be up to 255 characters.
- is a valid character, outside the forward slash "/".
- The Touch command allows you to create a blank file or to update the time of the existing file.
- Take the dot "." The file that starts with is a hidden file.
Iv. listing the contents of the catalogue
The ls command is used to list directory contents. The relevant parameters are as follows:
$ ls-a Show All files (including hidden files) $ ls-l Show details $ ls-r recursively display subdirectories $ ls-ld display directory and link information
V. Viewing file types
The File command allows you to view the type of files.
Six, absolute path and relative path
- Absolute path: Begins with a forward slash "/", and recursively knows the path to the destination for each level of the directory.
- Relative path: The path to the destination, starting at the current directory. Restricted by the current directory.
The CD command can be used to switch directories.
$ CD. Switch to the current directory $ cd : Switch previous Directory $ CD- switch previous working directory $ cd ~ switch to current user directory
Regardless of the directory, the direct CD returns to the current user directory /home/user name .
RELATED links: Linux directory detailed tree directory structure diagram
Linux entry record: Second, Linux file system basic structure