Build and use--linux directory structure and files in Linux development environment

Source: Internet
Author: User

Under the Windows platform, open "computer", we see a letter:



Under Linux, we don't see these drive characters, we see folders (directories):



In the early UNIX systems, each manufacturer defined its own UNIX system file directory, which was confusing. Shortly after the advent of Linux, the file directory was standardized, in 1994, the root file directory was unified, the introduction of FHS (Filesystem Hierarchy Standard) Linux file system hierarchy standards. The FHS standard specifies the name and function of each folder in the Linux root directory, which unifies the Linux world naming confusion situation.

No matter what version of the Linux distribution, desktop, application is the clothing of Linux, file organization, directory structure is the heart of Linux.


Linux directory structure

/: root directory, directory only, general root directory, do not store,/etc,/bin,/dev,/lib,/sbin should and root directory placed in a partition



/bin: /usr/bin: can be a directory that executes binary files, such as common commands ls, tar, MV, Cat, and so on.


/boot: Place Some files that are used by the Linux system when it is started. /boot/vmlinuz is the kernel file for Linux, as well as/boot/gurb. recommended separate partition, partition size 100M


/dev: store the device files under the Linux system and access a file in that directory, equivalent to accessing a device, which is commonly used to mount the optical drive mount/dev/cdrom/mnt.


/etc: the directory where the system configuration file is stored, the executable file is not recommended in this directory, the important configuration files are/etc/inittab,/etc/fstab,/ETC/INIT.D,/etc/x11,/etc/sysconfig, /etc/xinetd.d remember to back up before modifying the configuration file.

Note:/etc/x11 stores settings related to x Windows.


/home: The Default User house directory, add user account, the user's home directory is stored in this directory, ~ represents the current user's home directory, ~edu represents the user Edu home directory. It is recommended to separate partitions and set up a large disk space for user-friendly data storage


/lib:/usr/lib:/usr/local/lib : The system uses the library directory, the program in the execution process, need to call some additional parameters when the function library to assist, the more important directory for the/lib/modules.


/lost+fount: When a system exception is generated, some missing fragments are placed in this directory, which usually appears automatically in the Appliance directory. If the hard drive is loaded in/disk, the directory will be automatically generated in this directory/disk/lost+found


/mnt:/media: CD-ROM default mount point, usually the disc is mounted under/mnt/cdrom, or not necessarily, you can choose any location to mount.


/opt: A directory for the host to install additional software. For example: The Fedora Community development software used by FC4, if you want to install new KDE desktop software yourself, you can install the software in this directory. In the previous Linux system, it is customary to place it in the/usr/local directory


/proc: This directory data are in memory, such as system core, external device, network status, because the data are stored in memory, so do not occupy disk space, the more important directory has/proc/cpuinfo,/proc/interrupts,/proc/ DMA,/proc/ioports,/proc/net/*, and so on.


/root: system Administrator Root home directory, the system first boot partition is/, so it is best to put/root and//placed under a partition.


/sbin:/usr/sbin:/usr/local/sbin: Place executable commands that the system administrator uses, such as Fdisk, Shutdown, Mount, and so on. Unlike/bin, these directories are commands for the root of the system administrator, and the average user can only "view" and not be set up and used.


/ tmp: the directory where the files are temporarily stored by the general user or the program being executed, accessible to anyone, important data cannot be placed in this directory


/srv: The data directory that needs to be accessed after the service starts, such as the Web page data that the WWW service needs to store within/SRV/WWW.


/usr: application Storage directory, /usr/bin  Store application, /usr/ share  to store shared data, /usr/lib  The store cannot run directly, but is a number of library files that are necessary for many programs to run. /usr/local:  store the software upgrade package. /usr/share/doc:  System description file storage directory. /usr/share/man:   Program description file directory, query when using man ls usr/share/man/man1/ls.1.gz content A separate partition is recommended to set a larger disk space


/var: Place files that change frequently during the execution of the system, such as log files that change at any time/var/log,/var/log/message: All the login files are stored in the catalogue,/var/ Spool/mail: Mail storage directory,/var/run: after the program or service starts, its PID is stored in the directory. It is recommended to separate partitions to set large disk space

All documents

All documents

Linux for data files (*.mp3, *.bmp), Program Files (*.c, *.h, *.O), device files (LCD, touch screen, mouse), network files (sockets) and other management are abstracted as files, using a unified approach to management.


File classification:

1" Ordinary Files (data files)
Ordinary files are files used to hold information such as data, programs, etc., and are generally stored in external memory (disk) for a long time. Ordinary files are also divided into text files and binary files.


2) Catalog file
A catalog file is a file that consists of directory entries in a directory in a file system.

3) device files
A device file is a file that is used to provide connectivity to the operating system and the device. In a Linux system, the device is treated as a file, and the device is manipulated as if it were a normal file. Each device corresponds to a device file, which is stored in the/dev directory.

5) Linked files
Like shortcuts under Windows, links can be broken down into soft links (symbolic links) and hard links.

6) Piping Files
Pipeline files are primarily used to transfer data between processes in a special file.

7) Set of interface files
It is mainly used for a special file of network communication between different computers.


Build and use the--linux directory structure and files in the Linux development environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.