In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Linux how to operate the directory structure, I believe that many inexperienced people do not know what to do, so this paper summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
/-Root directory
First, let's introduce the root directory under Linux. The directory structure of Linux is like an upside-down tree, with the trunk at the bottom, followed by branches, subdivided layer by layer. The root directory is the lowest directory of Linux, just like the trunk of a big tree.
Everything is under the root directory, which is represented by a path symbol /. If you have to find an analogy, you can think of the root directory as the C:\ directory under Windows. But strictly speaking, the "/" under Linux is the root of everything (including file directories, devices, files, etc.), while C:\ under Windows is not, because if there are multiple disks or partitions, then there may be D:\ or E:\ under Windows.
We can change the current working path to the root directory by executing the command cd /. And display all the lower-level directories of the root directory with the command tree-L 1. As shown in figure 3. In this example, only the first-level subdirectories are shown, of course, you can also display the second-level subdirectories through-L 2, but the result may occupy the entire screen.
Figure 3 example of root directory
/ bin-user base binary file directory
The directory / bin is a level 1 subdirectory of the root directory. This directory contains the most basic user binaries, that is, applications. This directory is very similar to the Programs directory under Windows.
Not all applications are stored in this directory, and some programs that are not particularly basic are stored in the / usr/bin directory. For example, Chrome browsers, etc., or some programs installed by users themselves are usually under / usr/bin. System applications are usually under this directory, such as ls, mkdir, cp, and so on.
If you are using a desktop version of the operating system, you can see the contents of this directory through GUI. The picture below is a concrete example.
Figure 4 binary directory
/ boot-static startup file
The files contained under the directory / boot are the files used to boot the operating system. Such as GRUB boot loader files and operating system kernels. But the configuration file for boot loader is not here, but in the / etc directory.
/ cdrom-CD mounting point
The directory / cdrom is not part of the FHS standard, but we can see it in most distributions. This directory is the temporary mount point for the CD.
/ dev-device file
Under Linux, the device is also a file, such as a disk, flash drive or CD. Including wireless network card, camera and serial port are all a file. Usually these files are under the / dev directory, so you can switch to this directory to see the specific contents.
Figure 5 device catalog
The figure is a partial screenshot of the / dev directory. Probably the most common file under this directory is the file / dev/sda, which represents a SCSI disk.
In addition to dealing with physical devices, there are many pseudo devices under this directory. For example, / dev/random represents a device that generates random numbers, and / dev/loop0 is a virtual device that maps local files to disk. These pseudo devices are sometimes very useful, and we often use them to do some tests.
Figure 6 GUI directory
/ etc-profile
The configuration files for operating systems and applications are usually stored in a single directory, which is / etc. Many configuration files are stored here as text files. We can modify the configuration item through a text editor. For example, the IP address of the network, the configuration of Nginx and the configuration of system logs can be found here.
/ home-Home directory
This directory is called the home directory. Under the Linux operating system, each user usually has his or her own directory, which is under / home. For example, in this example, there is a user named zhangsn whose home directory is shown in figure 7 under / home.
The user's home directory contains the data file and the user-related configuration file. Usually a user can only modify the files in his directory and can only access other files with authorization.
Figure 7 Home directory of zhangsn
/ lib-basic shared library
The library files needed for the binaries (applications) in / bin and / sbin are stored in the / lib directory. The libraries that applications under / usr/bin depend on are usually under the / usr/lib directory.
/ lost+found-recoverable file
Each file system has a lost+found directory. If the file system crashes, a data check will be performed the next time the system starts. If a file with conflicting data is found during the inspection, it will be placed in this directory. This way, you can try to recover the file manually.
/ media-Removable Media
The subdirectories contained under the directory / media are mount points for some pluggable devices. When some pluggable devices are plugged into the computer, subdirectories are automatically created and mounted under this directory.
/ mnt-temporary mount point directory
The directory is usually empty. It is mainly used to mount some external file systems temporarily. For example, if there are multiple data disks, the formatted disk will be mounted to this directory. The mnt character is an abbreviation for mount, which means mounting.
/ opt-optional package (Optional Packages)
Self-installed unconventional software is usually installed in this directory.
/ proc-Kernel & Process Files
This directory is also a virtual directory, that is, it is not the directory where file data is stored. The files stored in this directory are usually used to obtain the internal information of the operating system kernel or process.
Figure 8 proc directory
For example, each process has a subdirectory under this directory, and the name of the letter is process ID. The details of the process can be obtained by reading the files in this directory through the cat command. For example, let's go to the directory / proc/258. This is the information of the process whose ID is 258. You can see the following through the ls command.
Figure 8 process details
/ root-root home directory
The directory / root is the home directory of the root user. The home directory of the root user is not under / home, but under the root directory. This needs to be noted.
/ run-Application status file
This directory is a relatively new directory for applications to store frequently changing files, such as file locks, process ID, or sockets, and so on.
/ sbin-system manages binaries
This directory is similar to the / bin directory and is used to store binaries. Unlike the / bin directory, this directory stores binaries for system management, such as disk format (mkfs), disk partition (fdisk), and network configuration (ifconfig) commands.
Figure 9 system commands
/ selinux-SELinux virtual file system
If your Linux distribution uses SELinux for security management, this directory contains files used by SELinux.
/ srv-Service data
This directory stores data provided by a specific service. Usually the directory is empty. The data in this directory is usually provided to external sources, such as user information stored on the Web website. Note the difference between / var and / tmp, which is provided to external users and used by the application itself, and the data in / tmp will be lost when restarted.
/ tmp-temporary file
Temporary data generated by an application is usually stored in this directory. A feature of this directory is that the data in the directory will be cleaned after the system is rebooted.
/ usr-User Binaries & Read-Only Data
Unlike the applications and files used by the system, the files of the application used by the user are stored in the / usr directory. For example, the system binaries are stored under / bin, while the binaries used by users are stored under / usr/bin. The system library files stored under / lib and the library files stored under / usr/lib are used by applications.
/ var-variable data file
The / var directory is a writable directory corresponding to the / usr directory, and the contents in the / usr directory are read-only, while / var is writable. Log files and some writes in normal operations are usually written to the / var directory. For example, log files are usually stored in / var/log.
After reading the above, have you mastered how to manipulate the directory structure in Linux? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.