From Wikipedia, the free encyclopedia
Directory structure used by a Unix-like operating system
"Usr" redirects here. For other uses, see
USR.
"Unix file system" redirects here. For UFS, a specific file system used by many Unix and Unix-like operating systems, see
Unix File System.
Version 7 Unix filesystem layout: subdirectories of "/" and "/usr" An overview of a Unix filesystem layoutIn Unix and operating systems inspired by it, the file system is considered a central component of the operating system.[1] It was also one of the first parts of the system to be designed and implemented by Ken Thompson in the first experimental version of Unix, dated 1969.[2]
As in other operating systems, the filesystem provides information storage and retrieval, and one of several forms of interprocess communication, in that the many small programs that traditionally form a Unix system can store information in files so that other programs can read them, although pipes complemented it in this role starting with the Third Edition. Also, the filesystem provides access to other resources through so-called device files that are entry points to terminals, printers, and mice.
The rest of this article uses Unix as a generic name to refer to both the original Unix operating system and its many workalikes.
The filesystem appears as one rooted tree of directories.[1] Instead of addressing separate volumes such as disk partitions, removable media, and network shares as separate trees (as done in DOS and Windows: each drive has a drive letter that denotes the root of its file system tree), such volumes can be mounted on a directory, causing the volume's file system tree to appear as that directory in the larger tree.[1] The root of the entire tree is denoted /
.
In the original Bell Labs Unix, a two-disk setup was customary, where the first disk contained startup programs, while the second contained users' files and programs. This second disk was mounted at the empty directory named usr
on the first disk, causing the two disks to appear as one filesystem, with the second disk’s contents viewable at /usr
.
Unix directories do not contain files. Instead, they contain the names of files paired with references to so-called inodes, which in turn contain both the file and its metadata (owner, permissions, time of last access, etc., but no name). Multiple names in the file system may refer to the same file, a feature termed a hard link.[1] The mathematical traits of hard links make the file system a limited type of directed acyclic graph, although the directories still form a tree, as they typically may not be hard-linked. (As originally envisioned in 1969, the Unix file system would in fact be used as a general graph with hard links to directories providing navigation, instead of path names.[2])
The original Unix file system supported three types of files: ordinary files, directories, and "special files", also termed device files.[1] The Berkeley Software Distribution (BSD) and System V each added a file type to be used for interprocess communication: BSD added sockets,[3] while System V added FIFO files.
BSD also added symbolic links (often termed "symlinks") to the range of file types, which are files that refer to other files, and complement hard links.[3] Symlinks were modeled after a similar feature in Multics,[4] and differ from hard links in that they may span filesystems and that their existence is independent of the target object. Other Unix systems may support additional types of files.[5]
Conventional directory layout[edit]Certain conventions exist for locating some kinds of files, such as programs, system configuration files, and users' home directories. These were first documented in the hier(7)
man page since Version 7 Unix;[6] subsequent versions, derivatives and clones typically have a similar man page.[7][8][9][10][11][12]
The details of the directory layout have varied over time. Although the file system layout is not part of the Single UNIX Specification, several attempts exist to standardize (parts of) it, such as the System V Application Binary Interface, the Intel Binary Compatibility Standard, the Common Operating System Environment, and Linux Foundation's Filesystem Hierarchy Standard (FHS).[13]
Here is a generalized overview of common locations of files on a Unix operating system:
Directory or file Description/
The slash /
character alone denotes the root of the filesystem tree.
/bin
ls
or cp
, that are needed to mount /usr
, when that is a separate filesystem, or to run in one-user (administrative) mode when /usr
cannot be mounted. In System V.4, this is a symlink to /usr/bin
. Otherwise, it needs to be on the root filesystem itself.
Contains all the files needed for successful booting process. In Research Unix, this was one file rather than a directory.[14] Nowadays usually on the root filesystem itself, unless the system, bootloader etc. require otherwise.
Stands for devices. Contains file representations of peripheral devices and pseudo-devices. See also: Linux Assigned Names and Numbers Authority. Needs to be on the root filesystem itself.
/etc
init
,[6] but these have typically been moved to /sbin
or elsewhere. Needs to be on the root filesystem itself.
/home
/usr
instead.[15] Some systems use or have used different locations still: macOS has home directories in /Users
, older versions of BSD put them in /u
, FreeBSD has /usr/home
.
/lib
/bin
, and possibly loadable kernel module, device drivers or binary blobs. Linux distributions may have variants /lib32
and /lib64
for multi-architecture support.
/media
/mnt
/opt
/proc
/root
/sbin
init
, usually needed to start, maintain and recover the system. Needs to be on the root partition itself.
/srv
/sys
/usr/src/sys
.
/tmp
/unix
/vmunix
.
/usr
/bin
or /usr/bin
.[17] It now holds executables, libraries, and shared resources that are not system critical, such as the X Window System, window managers, scripting languages, etc. In older Unix systems, user home directories might still appear in /usr
alongside directories containing programs, although by 1984 this depended on local customs.[14]
/usr/include
#include
directive in C language, which historically is how the name of this directory was chosen.
/usr/lib
/usr
or elsewhere.
/usr/libexec
/usr/lib
, where they also resided in 4.3BSD.
/usr/local
/usr
in structure, but 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
.
/usr/share
man
for manpages, that used to appear directly under /usr
in older versions.
/var
/var/log
/var/mail
root
) can access their own mail only. Often, this directory is a symbolic link to /var/spool/mail
.
/var/spool
/var/src
/var/tmp
/var/tmp
directory is a place for temporary files which should be preserved between system reboots.
stat(2)
– Linux Programmer's Manual – System Callshier(7)
– Version 7 Unix Programmer's Manualhier(7)
– FreeBSD Miscellaneous Information Manualhier(7)
– OpenBSD Miscellaneous Information Manualhier(7)
– Linux Programmer's Manual – Overview, Conventions and MiscellaneaRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3