The Linux file system hierarchy is a standardized directory organization method used to standardize the storage location of files and resources. 1. The root directory (/) is the starting point of the entire system, and all other directories are mounted here; 2. /bin stores basic commands for ordinary users, and /sbin stores administrator commands, and both are still available in single-user mode; 3. /etc saves system and service configuration files, such as /etc/passwd, /etc/hosts, etc.; 4. /home is the home directory of ordinary users, and /root is the home directory of superusers; 5. /dev contains device files, representing hardware devices; 6. /proc and /sys provide dynamic information of kernel, hardware and processes; 7. /tmp and /var/tmp are used for temporary files, the former is cleared after restarting, and the latter is retained for a longer time; 8. /usr stores user-level programs and read-only resources, such as /usr/bin, /usr/share. Understanding this structure helps quickly locate files, debug problems, and write scripts.
The Linux file system hierarchy is a standardized set of directories and file organization, with the goal of allowing different programs, users and services to find the resources they need. Simply put, it specifies where various files in the system should be placed.

1. /
(root directory)
This is the starting point for the entire file system, and all other directories are mounted under it. For example /home
, /etc
, /usr
, etc. It does not contain any actual data, it is just a "entry" to other directories.

Tips: Don’t put files into the root directory casually, as it can easily cause confusion.
2. /bin
and /sbin
——Basic command storage location
/bin
stores basic commands commonly used by ordinary users, such as ls
, cp
, and mv
; /sbin
is a command used by system administrators, such as reboot
and fdisk
.

They are characterized by: they can be used even if the system is in single-user mode, because these commands are crucial for system maintenance.
3. /etc
——The base camp of configuration files
Almost all services and programs configuration files are here. For example, network settings, user account information, software package configuration, etc.
Common examples:
-
/etc/passwd
: User account information -
/etc/hosts
: local host name resolution -
/etc/resolv.conf
: DNS settings
It is recommended to back up the original file before modification, such as using
sudo cp /etc/hostname /etc/hostname.bak
.
4. /home
and /root
— User home directory
The personal folders of each ordinary user are placed /home/用戶名
, such as /home/john
. /root
is the home directory of the super user (root), which is usually not accessible to ordinary users.
You can freely add files, scripts, download content, etc. here.
5. /dev
—— Where the device file is located
Linux also treats hardware devices as files, so this directory is full of device files, such as hard disk partition /dev/sda1
and terminal device /dev/tty
.
This type of file generally does not require manual modification and is automatically managed by the system.
6. /proc
and /sys
—— Virtual file system
These two directories are not real disk files, but runtime information interfaces.
-
/proc
provides kernel and process information, such as CPU information/proc/cpuinfo
-
/sys
focuses more on device drivers and hardware state
Their contents are dynamically updated as the system runs.
7. /tmp
and /var/tmp
— Temporary file storage
Programs or users can store temporary files here. The difference is:
-
/tmp
content will be cleared after restarting -
/var/tmp
cleansing frequency is low, suitable for longer-term temporary files
Pay attention to permission issues. Multiple users can write them, and try to avoid putting sensitive information here.
8. /usr
— User-level programs and data
Although the name is "user programs", it is now more like a read-only system resource directory. Included in:
-
/usr/bin
: User program -
/usr/sbin
: Systems hypervisor -
/usr/lib
: library file -
/usr/share
: Shared resources (such as documents, icons)
Basically, variable data will not be placed, so it is often mounted as read-only.
Basically that's it. Understanding the Linux file system structure will help you quickly locate configuration files, debug problems, and even write automated scripts much more convenient. Although it seems a bit too many, there are only a few directories commonly used. After getting familiar with it, you will naturally know where to go.
The above is the detailed content of What is the Linux filesystem hierarchy?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

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

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

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

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)

When encountering DNS problems, first check the /etc/resolv.conf file to see if the correct nameserver is configured; secondly, you can manually add public DNS such as 8.8.8.8 for testing; then use nslookup and dig commands to verify whether DNS resolution is normal. If these tools are not installed, you can first install the dnsutils or bind-utils package; then check the systemd-resolved service status and configuration file /etc/systemd/resolved.conf, and set DNS and FallbackDNS as needed and restart the service; finally check the network interface status and firewall rules, confirm that port 53 is not

If you find that the server is running slowly or the memory usage is too high, you should check the cause before operating. First, you need to check the system resource usage, use top, htop, free-h, iostat, ss-antp and other commands to check CPU, memory, disk I/O and network connections; secondly, analyze specific process problems, and track the behavior of high-occupancy processes through tools such as ps, jstack, strace; then check logs and monitoring data, view OOM records, exception requests, slow queries and other clues; finally, targeted processing is carried out based on common reasons such as memory leaks, connection pool exhaustion, cache failure storms, and timing task conflicts, optimize code logic, set up a timeout retry mechanism, add current limit fuses, and regularly pressure measurement and evaluation resources.

As a system administrator, you may find yourself (today or in the future) working in an environment where Windows and Linux coexist. It is no secret that some big companies prefer (or have to) run some of their production services in Windows boxes an

In Linux systems, 1. Use ipa or hostname-I command to view private IP; 2. Use curlifconfig.me or curlipinfo.io/ip to obtain public IP; 3. The desktop version can view private IP through system settings, and the browser can access specific websites to view public IP; 4. Common commands can be set as aliases for quick call. These methods are simple and practical, suitable for IP viewing needs in different scenarios.

Built on Chrome’s V8 engine, Node.JS is an open-source, event-driven JavaScript runtime environment crafted for building scalable applications and backend APIs. NodeJS is known for being lightweight and efficient due to its non-blocking I/O model and

In this article, we will learn how to install, update, remove, find packages, manage packages and repositories on Linux systems using YUM (Yellowdog Updater Modified) tool developed by RedHat. The example commands shown in this article are practicall

Linuxcanrunonmodesthardwarewithspecificminimumrequirements.A1GHzprocessor(x86orx86_64)isneeded,withadual-coreCPUrecommended.RAMshouldbeatleast512MBforcommand-lineuseor2GBfordesktopenvironments.Diskspacerequiresaminimumof5–10GB,though25GBisbetterforad

Written in C, MySQL is an open-source, cross-platform, and one of the most widely used Relational Database Management Systems (RDMS). It’s an integral part of the LAMP stack and is a popular database management system in web hosting, data analytics,
