Unix directory structure
Encyclopedia
In Unix
and Unix-like
operating system
s, 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
," 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.
What follows is a generalized overview of common locations of files in a Unix operating system:
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...
and Unix-like
Unix-like
A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....
operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...
s, 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
Filesystem Hierarchy Standard
The Filesystem Hierarchy Standard defines the main directories and their contents in Linux operating systems. For the most part, it is a formalization and extension of the traditional BSD filesystem hierarchy....
," however, it is targeted primarily at Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...
. Also, as part of the "Linux Standards Base", a common filesystem layout is defined, to encourage interoperability among different Linux distributions.
What follows is a generalized overview of common locations of files in a Unix operating system:
- / — the slash / character alone denotes the root of the virtual filesystem tree.
- /bin — stands for "binariesComputer programA computer program is a sequence of instructions written to perform a specified task with a computer. A computer requires programs to function, typically executing the program's instructions in a central processor. The program has an executable form that the computer can use directly to execute...
" and contains certain fundamental utilities, such as ls or cp, needed by all users.
- /sbin — stands for "system (or "superuser") binariesComputer programA computer program is a sequence of instructions written to perform a specified task with a computer. A computer requires programs to function, typically executing the program's instructions in a central processor. The program has an executable form that the computer can use directly to execute...
" and contains fundamental utilities, such as init, usually needed to start, maintain and recover the system.
- /etc — contains configuration files and system databases.
- /dev — stands for "devices". Contains file representations of peripheral devices.
-
-
- /dev/null — 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.
-
-
-
- /dev/random/dev/randomIn Unix-like operating systems, /dev/random is a special file that serves as a random number generator or as a pseudorandom number generator. It allows access to environmental noise collected from device drivers and other sources. Not all operating systems implement the same semantics for /dev/random...
— this pseudo device returns pseudorandom numbers (subject to the limitations of random number generators in computingComputingComputing is usually defined as the activity of using and improving computer hardware and software. It is the computer-specific part of information technology...
) 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 SSHSecure ShellSecure Shell is a network protocol for secure data communication, remote shell services or command execution and other secure network services between two networked computers that it connects via a secure channel over an insecure network: a server and a client...
that absolutely need cryptographically-strong random data to generate an encryptionEncryptionIn cryptography, encryption is the process of transforming information using an algorithm to make it unreadable to anyone except those possessing special knowledge, usually referred to as a key. The result of the process is encrypted information...
key.
- /dev/random
-
-
-
- /dev/urandom — similar to /dev/random, except it always returns (less cryptographically-strong) pseudorandom numbers, even if there is not enough entropy in the system noise available.
-
- /home — contains the home directories for the users.
- /mnt — contains filesystem mount points.
- /lib — contains system libraries.
- /root — the home directory for the superuserSuperuserOn many computer operating systems, the superuser is a special user account used for system administration. Depending on the operating system, the actual name of this account might be: root, administrator or supervisor....
root.
- /tmp — a place for temporary files. Many Unices clear this directory upon start up.
- /usr — originally the directory holding user home directories, its use has changed, and it now holds executables, libraries, and shared resources that are not system critical, like the X Window SystemX Window SystemThe X window system is a computer software system and network protocol that provides a basis for graphical user interfaces and rich input device capability for networked computers...
, KDEKDEKDE is an international free software community producing an integrated set of cross-platform applications designed to run on Linux, FreeBSD, Microsoft Windows, Solaris and Mac OS X systems...
, PerlPerlPerl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular...
, etc. (The name "Unix System Resources" is a post hoc backronymBackronymA backronym or bacronym is a phrase constructed purposely, such that an acronym can be formed to a specific desired word. Backronyms may be invented with serious or humorous intent, or may be a type of false or folk etymology....
.) However, on some UnixUnixUnix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...
systems, some user accounts may still have a home directory that is a direct subdirectory of /usr, such as the default as in MinixMinixMINIX is a Unix-like computer operating system based on a microkernel architecture created by Andrew S. Tanenbaum for educational purposes; MINIX also inspired the creation of the Linux kernel....
.
-
-
- /usr/bin — this directory stores all binary programs distributed with the operating system not residing in /bin, /sbin or (rarely) /etc.
-
-
-
- /usr/include — /usr/include stores the development headers used throughout the system.
-
-
-
- /usr/lib — stores the required libraries for executables within /usr or elsewhere.
-
-
-
- /usr/local — 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 collectionPorts collectionPorts collections are the sets of makefiles and patches provided by the BSD-based operating systems, FreeBSD, NetBSD, and OpenBSD, as a simple method of installing software or creating binary packages...
. Usually has subdirectories such as /usr/local/lib or /usr/local/bin.
- /usr/local — 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
-
- /var — a short for "variable." A place for files that may change often.
-
-
- /var/log — contains system log files.
-
-
-
- /var/mail — the place where all the incoming mails are stored. The user can access his/her own mail only, unless he/she has admin rights.
-
-
-
- /var/spool — spoolSpoolingIn computer science, spool refers to the process of placing data in a temporary working area for another program to process. The most common use is in writing files on a magnetic tape or disk and entering them in the work queue for another process. Spooling is useful because devices access data at...
directory; contains print jobs, mail spools and other queued tasks.
- /var/spool — spool
-
-
-
- /var/tmp — A place for temporary files preserved between system reboots.
-
- /proc — contains all processing data (Process information about a running operating system).
- /opt — contains add-on software.
- /media — default mount point for removable devices.
- /srv — server data (data for services provided by system).
- /boot — contains all the important files which are required for successful booting process.
- /sys — contains information related to hardware.