What is the root directory in linux
In Linux, the root directory "/" is located at the top level of the file system directory structure and is the top-level directory. All files and directories are placed under the root directory "/"; the root directory "/" "There are also subdirectories such as "/bin", "/home", and "/usr" below.
#The operating environment of this tutorial: CentOS 6 system, Dell G3 computer.
The root directory of the Linux system (/)
The file system of Linux and UNIX is a hierarchical tree file structure with "/" as the root, "/" is therefore called Root directory.
All files and directories are placed under the root directory "/". There are subdirectories such as /bin, /home, /usr and so on under the root directory /.
FHS standard recommendation: The partition where the root directory "/" is located should be The smaller the better, and the software installed by the application should not be placed with the root directory Within the same partition, keep the root directory as small as possible.
Linux philosophy
1. Everything is a file;
2. Small programs with a single purpose; combine small programs to complete complex tasks;
3. Try to avoid capturing the user interface;
4. Save the configuration information of the program through the configuration file, and the configuration file is usually a plain text file;
root
$ ls / bin dev home lib64 mnt proc run srv usr boot etc lib media opt root sbin sys tmp var
(1)bin
Binary binary
The storage directory of the executable program files corresponding to many "instructions" ls
, pwd
, init
etc.
(2)boot
Mainly places files used for booting, including Linux core files, boot menu and configuration files required for booting, etc. wait. The commonly used file name of Linux kernel is: vmlinuz . If you are using grub, the boot management program, the directory /boot/grub/ will also exist!
(3) dev
On a Linux system, any device and peripheral equipment exists in this directory in the form of files. Simply accessing a file in this directory is equivalent to accessing a device. The more important files include /dev/null, /dev/zero, /dev/tty, /dev/lp*, /dev/hd*, /dev/sd*, etc.
(4) etc
Almost all the main configuration files of the system are placed in this directory, such as personnel account and password files, startup files of various services, etc. Generally speaking, the attributes of each file in this directory can be viewed by ordinary users, but only root has the authority to modify them. FHS recommends not placing executable files (binary) in this directory. The more important files are: /etc/inittab, /etc/init.d/, /etc/modprobe.conf, /etc/X11/, /etc/fstab, /etc/sysconfig/, etc. In addition, the important directories under it are:
- /etc/init.d/ : The default startup scripts of all services are placed here, for example, to start or To turn off iptables: "/etc/init.d/iptables start", "/etc/init.d/iptables stop"
- /etc/xinetd.d/: This is what is called The configuration file directory of various services managed by the super daemon.
- /etc/X11/: Various configuration files related to X Window are here, especially the two X Server configuration files, xorg.conf or XF86Config.
(5) home
This is the system’s default user home directory. When you add a general user account, the default user home directory will be standardized here. More importantly, the home directory has two codenames:
~: represents the current user's home directory, and ~guest: represents the home directory of the user named guest!
(6)lib
There are many function libraries in the system, and /lib places the function libraries that will be used when booting, as well as in /bin or /sbin The following command will just call the function library. What is a function library? You can think of it as a "plug-in". Certain instructions require these "plug-ins" to successfully complete the execution of the program. Particularly important is the directory /lib/modules/, because this directory will contain core-related modules (drivers)!
(7) lib64
(8) media
Media is the English word for "media". As the name suggests, the removable device placed under /media is! Devices including floppy disks, compact discs, DVDs, etc. are temporarily mounted here. Common file names include: /media/floppy, /media/cdrom, etc.
(9)mnt
If you want to temporarily mount some additional devices, it is generally recommended that you place them in this directory. In ancient times, the purpose of this directory was the same as /media! Only after /media is created, this directory is used for temporary mounting.
(10)opt
This is the directory where third-party collaborative software is placed. What is third-party collaborative software? For example, the KDE desktop management system is an independent project, but it can be installed on a Linux system, so it is recommended that KDE software be placed in this directory. In addition, if you want to install additional software (not provided by the original distribution), you can also install your software here. However, in previous Linux systems, we were still used to placing it in the /usr/local directory!
(11)proc
This directory itself is a "virtual filesystem (virtual filesystem)"! The data he places are all in the memory, such as the system core, process information (is it a process?), the status of peripheral devices, network status, etc. Because the data in this directory are all in the memory (memory), it does not occupy any hard disk space! More important files (directories) such as: /proc/cpuinfo, /proc/dma, /proc/interrupts, /proc/ioports, /proc/net/*, etc. Haha, is it virtual memory [guest]?
(12) root
The home directory of the system administrator (root). The reason why it is placed here is because if you enter single-player maintenance mode and only mount the root directory, the directory can have root's home directory, so we would like root's home directory and the root directory to be placed in the same partition.
(13)run
The things inside are needed when the system is running and cannot be deleted casually. But they should be discarded when restarting. They will be regenerated the next time the system is running.
(14)sbin
Linux has a lot of commands used to set the system environment. These commands can only be used by root to "set" the system, othersUsers can only use it to "query" at most. What is placed under /sbin is what is needed during the boot process, including the commands needed to boot, repair, and restore the system. As for some server software programs, they are generally placed in /usr/sbin/. As for the system executable file (system binary) generated by the software installed on the local machine, it is placed in /usr/local/sbin/. Common instructions include: fdisk, fsck, ifconfig, init, mkfs, etc.
(15)srv
srv can be regarded as the abbreviation of "service". It is the data directory that these services need to access after some network services are started. Common services such as WWW, FTP, etc. For example, the web page data required by the WWW server can be placed in /srv/www/. Haha, it seems that the code we usually write should be placed here.
(16) sys
This directory is actually very similar to /proc. It is also a virtual file system that mainly records core-related information. Including currently loaded core modules and hardware device information detected by the core, etc. This directory also does not occupy hard disk space!
(17)tmp
This is a place where ordinary users or running programs can temporarily place files. This directory is accessible to anyone, so you need to clean it regularly. Of course, important information cannot be placed in this directory! Because FHS even recommends that all data under /tmp should be deleted when booting!
(18) usr
/usr is the core of the system and contains all shared files. It is one of the most important directories in the unix system, covering binary files, various documents, various header files, x, and various library files; there are also many programs, such as ftp, telnet, etc.
(19)var
/var/log, log file
/var/run, pid file
/var/mail, the storage location of user mail
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of What is the root directory in linux. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



DeepSeek is a powerful intelligent search and analysis tool that provides two access methods: web version and official website. The web version is convenient and efficient, and can be used without installation; the official website provides comprehensive product information, download resources and support services. Whether individuals or corporate users, they can easily obtain and analyze massive data through DeepSeek to improve work efficiency, assist decision-making and promote innovation.

There are many ways to install DeepSeek, including: compile from source (for experienced developers) using precompiled packages (for Windows users) using Docker containers (for most convenient, no need to worry about compatibility) No matter which method you choose, Please read the official documents carefully and prepare them fully to avoid unnecessary trouble.

Solution to permission issues when viewing Python version in Linux terminal When you try to view Python version in Linux terminal, enter python...

BITGet is a cryptocurrency exchange that provides a variety of trading services including spot trading, contract trading and derivatives. Founded in 2018, the exchange is headquartered in Singapore and is committed to providing users with a safe and reliable trading platform. BITGet offers a variety of trading pairs, including BTC/USDT, ETH/USDT and XRP/USDT. Additionally, the exchange has a reputation for security and liquidity and offers a variety of features such as premium order types, leveraged trading and 24/7 customer support.

Gate.io is a popular cryptocurrency exchange that users can use by downloading its installation package and installing it on their devices. The steps to obtain the installation package are as follows: Visit the official website of Gate.io, click "Download", select the corresponding operating system (Windows, Mac or Linux), and download the installation package to your computer. It is recommended to temporarily disable antivirus software or firewall during installation to ensure smooth installation. After completion, the user needs to create a Gate.io account to start using it.

Ouyi OKX, the world's leading digital asset exchange, has now launched an official installation package to provide a safe and convenient trading experience. The OKX installation package of Ouyi does not need to be accessed through a browser. It can directly install independent applications on the device, creating a stable and efficient trading platform for users. The installation process is simple and easy to understand. Users only need to download the latest version of the installation package and follow the prompts to complete the installation step by step.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Ouyi, also known as OKX, is a world-leading cryptocurrency trading platform. The article provides a download portal for Ouyi's official installation package, which facilitates users to install Ouyi client on different devices. This installation package supports Windows, Mac, Android and iOS systems. Users can choose the corresponding version to download according to their device type. After the installation is completed, users can register or log in to the Ouyi account, start trading cryptocurrencies and enjoy other services provided by the platform.
