Linux directory structure

For beginners to learn Linux, you first need to clarify the Linux standard directory structure

Share pictures

/

  • root — Some core files used when starting Linux. Such as operating system kernel, boot program Grub, etc.
  • home — store personal files of ordinary users
    • ftp — all user services
    • httpd
    • samba
    • user1
    • user2
  • bin — The executable file (binary) required for system startup
  • sbin- – A directory of executable programs, but most of them store commands related to system management. Only root privileges can be executed
  • proc — virtual, there is a linux kernel image; save all kernel parameters and system configuration information
    • 1 — process number
  • usr — user directory, storing user-level files
    • bin — commands used by almost all users, in addition to /bin, /usr/local/bin
    • sbin — system administrator command, related to users, for example, most server programs
    • include — store C/ The directory of the C++ header file
    • lib — fixed program data
    • local — local installation software save location
    • man – -Manually generated directory
    • info — Information document
    • doc — Different package document information
    • tmp
    • X11R6- – This directory is used to save all files needed to run X-Window. This directory also contains the configuration files and binary files needed to run the GUI.
    • X386 — The function is the same as the system files of X11R6, X11 release 5
  • boot — Required for boot loader Files and pictures needed by the system are stored here
  • lib — Programs in the root file system directory And the common libraries of core modules
    • modules — loadable modules, modules needed to restart after system crash
  • dev — device file directory
  • etc — configuration file
    • skel — home directory is created, the directory is initialized
    • sysconfig — network, Time, keyboard and other configuration directories
  • var
    • file
    • lib — When the system is running, the files in this directory Will change
    • local — program data installed in /usr/local, changed
    • lock — the file uses a specific peripheral or file, lock it, other The file is temporarily inaccessible
    • log — record log
    • run — legal information about system operation
    • spool — printer, mail, proxy server, etc. Spool directory
    • tmp
    • catman — cache directory
  • mnt — temporarily used to mount files System place. Under normal circumstances, this directory is empty, but when we are about to mount the partition, create a directory in this directory, and then mount the device we will access to this directory, so that we can access the files.
  • tmp — temporary file directory. Temporary files after system startup are stored in /var/tmp
  • lost+found — files restored when the file system is repaired
  • li>

/: The root directory. Generally, only directories are stored under the root directory, not files, /etc , /Bin, /dev, /lib, /sbin should be placed in the same partition as the root directory

/bin:/usr/bin: the directory of executable binary files, Such as commonly used commands ls, tar, mv, cat, etc.

/boot: Place some files used when the linux system starts. /boot/vmlinuz is the kernel file of linux, and /boot/gurb. It is recommended to partition separately. The partition size is 100M.

/dev: Store the device files under the Linux system, and access a file in the directory, which is quite To access a certain device, the commonly used method is to mount the CD-ROM drive mount /dev/cdrom /mnt.

/etc: The directory where system configuration files are stored. It is not recommended to store executable files in this directory. Important configuration files are /etc/inittab, /etc/fstab, Remember to back up /etc/init.d, /etc/X11, /etc/sysconfig, /etc/xinetd.d before modifying the configuration file.

Note: /etc/X11 stores the settings related to x windows.

/home: The system default user home directory. When adding a user account, the user’s home directory is stored in this directory, ~ represents the current user’s home directory,~ test represents the home directory of user test. It is recommended to partition separately and set a larger disk space to facilitate users to store data

/lib:/usr/lib:/usr/local/lib: strong>The directory of the function library used by the system. During the execution of the program, some additional parameters need to be called with the assistance of the function library. The more important directory is /lib/modules.

/lost+fount: When a system error occurs, some missing fragments will be placed in this directory. Usually this directory will automatically appear in the device directory. If the hard disk is loaded in /disk, the directory /disk/lost+found will be automatically generated under this directory.

/mnt:/media: The default mount point of the CD, usually CD Mounted under /mnt/cdrom, it is not necessarily, you can choose any location to mount.

/opt: The directory where additional installation software is placed on the host. For example: Fedora community development software used by FC4. If you want to install the new KDE desktop software yourself, you can install the software in this directory. In previous Linux systems, it was customary to place it in the /usr/local directory

/proc: The data in this directory are all in memory, such as system core, external devices, network status , Since the data is stored in the memory, it does not occupy disk space. The more important directories are /proc/cpuinfo, /proc/interrupts, /proc/dma, /proc/ioports, /proc/net/*, etc.

/root: The home directory of the system administrator root, the first partition of the system to boot is /, so it is best to place /root and / under one partition.

/sbin:/usr/sbin:/usr/local/sbin: Place executable commands used by system administrators, such as fdisk, shutdown, mount, etc. Unlike /bin, these directories are commands used by the system administrator root, and general users can only “view” but cannot set and use them.

/tmp: The directory where general users or programs that are executing temporarily store files, anyone can access, important data cannot be placed in this directory

/srv: The data directory that needs to be accessed after the service is started. For example, the web page data that the www service needs to access is stored in /srv/www

/usr: strong>Application storage directory, /usr/bin stores applications, /usr/share stores shared data, /usr/lib cannot be stored It runs directly, but it is some function library files necessary for the running of many programs. /usr/local: Store the software upgrade package. /usr/share/doc: The directory where the system description files are stored. /usr/share/man: Program description file storage directory, when using man ls, it will query /usr/share/man/man1/ls.1 The content of .gzSuggest a separate partition and set a larger disk space

/var: Place the frequently changed system during execution Files, such as the log file /var/log that changes at any time, /var/log/message: The directory where all login files are stored, /var/spool/mail: Mail storage /var/run: After the program or service is started, its PID is stored in this directory. It is recommended to partition separately and set a larger disk space

/: root directory, general root directory Only store directories, do not store files. /etc, /bin, /dev, /lib, /sbin should be placed in the same partition as the root directory

/bin:/usr/bin: The directory of executable binary files, such as commonly used commands ls, tar, mv, cat, etc.

/boot: Place some files used when the linux system starts. /boot/vmlinuz is the kernel file of linux, and /boot/gurb. It is recommended to partition separately. The partition size is 100M.

/dev: Store the device files under the Linux system, and access a file in the directory, which is quite To access a certain device, the commonly used method is to mount the CD-ROM drive mount /dev/cdrom /mnt.

/etc: The directory where system configuration files are stored. It is not recommended to store executable files in this directory. Important configuration files are /etc/inittab, /etc/fstab, Remember to back up /etc/init.d, /etc/X11, /etc/sysconfig, /etc/xinetd.d before modifying the configuration file.

Note: /etc/X11 stores the settings related to x windows.

/home: The system default user home directory. When adding a user account, the user’s home directory is stored in this directory, ~ represents the current user’s home directory,~ test represents the home directory of user test. It is recommended to partition separately and set a larger disk space to facilitate users to store data

/lib:/usr/lib:/usr/local/lib: strong>The directory of the function library used by the system. During the execution of the program, some additional parameters need to be called with the assistance of the function library. The more important directory is /lib/modules.

/lost+fount: When a system error occurs, some missing fragments will be placed in this directory. Usually this directory will automatically appear in the device directory. If the hard disk is loaded in /disk, the directory /disk/lost+found will be automatically generated under this directory.

/mnt:/media: The default mount point of the CD, usually CD Mounted under /mnt/cdrom, it is not necessarily, you can choose any location to mount.

/opt: The directory where additional installation software is placed on the host. For example: Fedora community development software used by FC4. If you want to install the new KDE desktop software yourself, you can install the software in this directory. In previous Linux systems, it was customary to place it in the /usr/local directory

/proc: The data in this directory are all in memory, such as system core, external devices, network status , Since the data is stored in the memory, it does not occupy disk space. The more important directories are /proc/cpuinfo, /proc/interrupts, /proc/dma, /proc/ioports, /proc/net/*, etc.

/root: The home directory of the system administrator root, the first partition of the system to boot is /, so it is best to place /root and / under one partition.

/sbin:/usr/sbin:/usr/local/sbin: Place executable commands used by system administrators, such as fdisk, shutdown, mount, etc. Unlike /bin, these directories are commands used by the system administrator root, and general users can only “view” but cannot set and use them.

/tmp: The directory where general users or programs that are executing temporarily store files, anyone can access, important data cannot be placed in this directory

/srv: The data directory that needs to be accessed after the service is started. For example, the web page data that the www service needs to access is stored in /srv/www

/usr: strong>Application storage directory, /usr/bin stores applications, /usr/share stores shared data, /usr/lib cannot be stored It runs directly, but it is some function library files necessary for the running of many programs. /usr/local: Store the software upgrade package. /usr/share/doc: The directory where the system description files are stored. /usr/share/man: Program description file storage directory, when using man ls, it will query /usr/share/man/man1/ls.1 The content of .gzSuggest a separate partition and set a larger disk space

/var: Place the frequently changed system during execution Files, such as the log file /var/log that changes at any time, /var/log/message: The directory where all login files are stored, /var/spool/mail: Mail storage /var/run: After the program or service is started, its PID is stored in this directory. It is recommended to partition separately and set a larger disk space

Leave a Comment

Your email address will not be published.