World Library  
Flag as Inappropriate
Email this Article

Unix filesystem

Article Id: WHEBN0023453203
Reproduction Date:

Title: Unix filesystem  
Author: World Heritage Encyclopedia
Language: English
Subject: Unix, Reference counting
Publisher: World Heritage Encyclopedia

Unix filesystem

Version 7 Unix filesystem layout: subdirectories of "/" and "/usr"

In 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 1969.[2]

Like in other operating systems, the filesystem provides information storage and retrieval, as well as interprocess communication, in the sense that the many small programs that traditionally comprise a Unix system can store information in files so that other programs can read these, although pipes complemented it in this role starting with the Third Edition. Additionally, 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 as well as its many workalikes.


The filesystem appears as a single rooted tree of directories.[3] Instead of addressing separate volumes such as disk partitions, removable media, and network shares as separate trees (as done in MS-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.[3] 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's disks 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 known as (hard) linking.[3] If this feature is taken into account, the file system is a limited type of directed acyclic graph, although the directories still form a tree, as they may typically 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])

File types

The original Unix file system supported three types of files: ordinary files, directories, and "special files", also known as device files.[3] The Berkeley Software Distribution (BSD) and System V each added a file type to be used for interprocess communication: BSD added sockets,[4] while System V added FIFO files.

BSD also added symbolic links to the range of file types, which are files that refer to other files, and complement hard links.[4] Other Unix systems may support additional types of files.[5]

Conventional directory layout

Certain conventions exist for locating particular 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]

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 it, such as the Linux Foundation's Filesystem Hierarchy Standard (FHS).

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.
Stands for "binaries" and contains certain fundamental utilities, such as ls or cp, that are needed to mount /usr, when that's a separate filesystem, or to run in single-user (administrative) mode when /usr cannot be mounted. In System V.4, this is a symlink to /usr/bin.
Contains all the files that are required for successful booting process. In Research Unix, this was a single file rather than a directory.[12]
Stands for "devices". Contains file representations of peripheral devices and pseudo-devices.
Contains system-wide configuration files and system databases; the name stands for "et cetera".[12] Originally also contained "dangerous maintenance utilities" such as init,[13] but these have typically been moved to /sbin or elsewhere.
Contains user home directories on Linux and some other systems. In the original version of Unix, home directories were in /usr instead.[14] Some systems use or have used different locations still: OS X has home directories in /Users, older versions of BSD put them in /u, FreeBSD has /usr/home.
Originally "essential libraries": C libraries, but not Fortran ones.[12] On modern systems, contains the shared libraries needed by programs in /bin, and possibly loadable kernel module or device drivers. Linux distributions may have variants /lib32 and /lib64 for multi-architecture support.
Default mount point for removable devices, such as USB sticks, media players, etc.
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 (network) filesystems, CD-ROM/DVD drives, and so on.
Contains locally installed software. Originated in System V, which has a package manager that installs software to this directory (one subdirectory per package).[15]
procfs virtual filesystem showing information about processes as files.
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.
Stands for "system (or superuser) binaries" and contains fundamental utilities, such as init, usually needed to start, maintain and recover the system.
Server data (data for services provided by system).
In some Linux distributions, contains a sysfs virtual filesystem, containing information related to hardware and the operating system. On BSD systems, commonly a symlink to the kernel sources in /usr/src/sys.
A place for temporary files. Many systems clear this directory upon startup; it might have tmpfs mounted atop it, in which case its contents do not survive a reboot, or it might be explicitly cleared by a startup script at boot time.
The Unix kernel in Research Unix and System V.[12] With the addition of virtual memory support to 3BSD, this got renamed /vmunix.
The "user file system": originally the directory holding user home directories,[14] but already by the Third Edition of Research Unix, ca. 1973, reused to split the operating system's programs over two disks (one of them a 256K fixed-head drive) so that basic commands would either appear in /bin or /usr/bin.[16] It now holds executables, libraries, and shared resources that are not system critical, like the X Window System, KDE, Perl, 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".[12]
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.
On BSD systems[6] and older distributions of Linux, programs that are meant to be executed by other programs rather than by users directly. E.g., the Sendmail executable may be found in this directory.[17] Not present in the FHS; Linux distributions have typically moved the contents of this directory into /usr/lib, where they also resided in 4.3BSD.
Resembles /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.
Architecture-independent program data. On Linux and modern BSD derivatives, this directory has subdirectories such as man for manpages, that used to appear directly under /usr in older versions.
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.

See also


  • This article incorporates material from the Citizendium article "Unix filesystem", which is licensed under the but not under the .
  1. ^ Ritchie, D.M.; Thompson, K. (July 1978). "The UNIX Time-Sharing System". Bell System Tech. J. (USA: AT&T) 57 (6): 1905–1929.  
  2. ^ a b  
  3. ^ a b c d
  4. ^ a b Leffler, Samuel J.;  
  5. ^  – FreeBSD System Calls Manual
  6. ^ a b "hier(7) man page for OpenBSD". Retrieved 14 September 2013. 
  7. ^ "hier(7) man page for FreeBSD". 
  8. ^ "hier(7) man page for 2.9.1 BSD". 
  9. ^ "hier(7) man page for ULTRIX 4.2". 
  10. ^ "hier(7) man page for SunOS 4.1.3". 
  11. ^ "hier(7) man page for Linux". 
  12. ^ a b c d e  
  13. ^ hier(7) in the Seventh Edition Unix manual.
  14. ^ a b Ritchie, Dennis. "Unix Notes from 1972". Retrieved 4 October 2012. 
  15. ^ System V Application Binary Interface Edition 4.1 (1997-03-18)
  16. ^ M. D. McIlroy (1987). A Research Unix reader: annotated excerpts from the Programmer's Manual, 1971–1986. CSTR 139, Bell Labs.
  17. ^ "Chapter 7. sendmail".  
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.