In Unix and Unix-like operating systems, the Unix directory structure is a convention for filesystem layout.
Several attempts exist to standardize the Unix filesystem layout, such as the "Filesystem Hierarchy Standard,"[1] however, it is targeted primarily at Linux. Also, as part of the "Linux Standards Base", a common filesystem layout is defined, to encourage interoperability among different Linux distributions.[2]
What follows is a generalized overview of common locations of files in a Unix operating system:
Directory or file | Description |
---|---|
/
|
The slash / character alone denotes the root of the filesystem tree.
|
|
Stands for "binaries" and contains certain fundamental utilities, such as ls or cp , which are generally needed by all users.
|
|
Stands for "system (or superuser) binaries" and contains fundamental utilities, such as init , usually needed to start, maintain and recover the system.
|
|
Contains system-wide configuration files and system databases. |
|
Stands for "devices". Contains file representations of peripheral devices. |
Also known as the "bit bucket" or "black hole", this pseudo-device discards all contents written to it, and is typically used to pipe away unwanted data. | |
This pseudo-device returns pseudorandom numbers (subject to the limitations of random number generators in computing) when read from. It uses system noise to generate random numbers and blocks if not enough entropy in the noise is available. Random is commonly used by programs such as SSH that absolutely need cryptographically strong random data to generate an encryption key. | |
|
Similar to /dev/random , except it always returns (cryptographically less strong) pseudorandom numbers, even if there is not enough entropy in the system noise available.
|
|
An endless supply of null's (0x00). Useful for "zeroing" a disk drive (i.e. dd if=/dev/zero of=/dev/... bs=64k) |
|
Contains the home directories for the users. |
|
Stands for "mount". Contains filesystem mount points. These are used, for example, if the system uses multiple hard disks or hard disk partitions. It is also often used for remote filesystems, CD-ROM/DVD drives, and so on. |
|
Contains system libraries, and some critical files such as kernel modules or device drivers. |
|
The home directory for the superuser "root" - that is, the system administrator. This account's home directory is usually on the initial filesystem, and hence not in /home (which may be a mount point for another filesystem) in case specific maintenance needs to be performed, during which other filesystems are not available. Such a case could occur, for example, if a hard disk drive suffers physical failures and cannot be properly mounted. |
|
A place for temporary files. Many Unices clear this directory upon startup. |
|
Originally the directory holding user home directories, its use has changed. It now holds executables, libraries, and shared resources that are not system critical, like the X Window System, KDE, Perl, etc. (The name "Unix System Resources" is a post hoc backronym[citation needed].) However, on some Unix systems, some user accounts may still have a home directory that is a direct subdirectory of /usr, such as the default as in Minix. (on modern systems, these user accounts are often related to server or system use, and not directly used by a person) |
|
This directory stores all binary programs distributed with the operating system not residing in /bin , /sbin or (rarely) /etc .
|
|
Stores the development headers used throughout the system. Header files are mostly used by the #include directive in C programming language, which historically is how the name of this directory was chosen.
|
|
Stores the required libraries and data files for programs stored within /usr or elsewhere.
|
|
Resembles /usr , except that its subdirectories are used for additions not part of the operating system distribution, such as custom programs or files from a BSD Ports collection. Usually has subdirectories such as /usr/local/lib or /usr/local/bin .
|
|
A short for "variable." A place for files that may change often - especially in size, for example e-mail sent to users on the system, or process-ID lock files. |
|
Contains system log files. |
|
The place where all the incoming mails are stored. Users (other than root ) can access their own mail only. Often, this directory is a symbolic link to /var/spool/mail .
|
|
Spool directory. Contains print jobs, mail spools and other queued tasks. |
|
A place for temporary files which should be preserved between system reboots. |
|
Contains all processing data (process information about a running operating system). Usually, the entire contents of this directory is created on-the-fly by the operating system's kernel when it is read by a process; it does not actually exist on disk. The contents reflects the current and immediate state of the system and all processes running on it. There is normally a special filesystem of type "proc" mounted here (or "none" on some systems) as shown by the "mount" command. |
|
Contains add-on software. Some large program suites may prefer to be installed here, rather than under /usr .
|
|
Default mount point for removable devices, such as USB sticks, media players, etc. |
|
Server data (data for services provided by system). |
|
Contains all the important files which are required for successful booting process. |
|
Contains information related to hardware. See /proc above.
|
References
- This article incorporates material from the Citizendium article "Unix filesystem", which is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License but not under the GFDL.
- ^ "Filesystem Hierarchy Standard". Retrieved 2007-07-25.
- ^ "Linux Standards Base". Retrieved 2007-07-25.