Unix filesystem: Difference between revisions

Content deleted Content added
No edit summary
Tags: Mobile edit Mobile app edit iOS app edit
Monkbot (talk | contribs)
m Task 18 (cosmetic): eval 12 templates: hyphenate params (12×);
Line 4:
[[File:Standard-unix-filesystem-hierarchy.svg|thumb|An overview of a [[Unix]] filesystem layout]]
 
In [[Unix]] and [[operating system]]s inspired by it, the [[file system]] is considered a central component of the operating system.<ref name=" Ritchie">{{cite journal |last1= Ritchie |first1= D.M. |authorlink1author-link1= Dennis Ritchie |last2= Thompson |first2= K. |authorlink2author-link2= Ken Thompson |title= The UNIX Time-Sharing System |journal= Bell System Tech. J. |volume= 57 |issue= 6 |pages= 1905–1929 |date= July 1978 |doi=10.1002/j.1538-7305.1978.tb02136.x|citeseerx= 10.1.1.112.595 }}</ref> 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, [[History of Unix|dated 1969]].<ref name="evolution"/>
 
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 [[Pipeline (Unix)|pipes]] complemented it in this role starting with the [[Research Unix|Third Edition]]. Also, the filesystem provides access to other resources through so-called ''[[device file]]s'' that are entry points to [[computer terminal|terminals]], [[computer printer|printers]], and [[computer mouse|mice]].
Line 20:
{{Main |Unix file types}}
 
The original Unix file system supported three types of files: ordinary files, [[Directory (computing)|directories]], and "special files", also termed device files.<ref name="Ritchie"/> The [[Berkeley Software Distribution]] (BSD) and [[UNIX System V|System V]] each added a file type to be used for [[interprocess communication]]: BSD added [[Berkeley sockets|sockets]],<ref name="43bsd">{{cite book |last1= Leffler |first1= Samuel J. |authorlink1author-link1= Samuel J Leffler |last2= McKusick |first2= Marshall Kirk |authorlink2author-link2= Marshall Kirk McKusick |last3= Karels |first3= Michael J. |authorlink3author-link3= Michael J. Karels |last4= Quarterman |first4= John S. |authorlink4author-link4= John Quarterman |title= The Design and Implementation of the 4.3BSD UNIX Operating System |date= October 1989 |publisher= [[Addison-Wesley]] |isbn= 978-0-201-06196-3 |url-access= registration |url= https://archive.org/details/designimplementa0000unse }}</ref> while System V added [[Named pipe#In Unix|FIFO files]].
 
BSD also added [[symbolic link]]s (often termed "symlinks") to the range of file types, which are files that refer to other files, and complement hard links.<ref name="43bsd"/> Symlinks were modeled after a similar feature in [[Multics]],<ref name="FFS">{{cite web|last1=McKusick|display-authors=etal|first1=Marshall Kirk|title=A Fast Filesystem for Unix|url=https://docs.freebsd.org/44doc/smm/05.fastfs/paper.pdf|website=Freebsd.org|publisher=CSRG, UC Berkeley|accessdateaccess-date=16 November 2016}}</ref> 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.<ref>{{man|2|stat|Linux}}</ref>
 
==Conventional directory layout==
Certain conventions exist for locating some kinds of files, such as programs, system configuration files, and users' [[home directory|home directories]]. These were first documented in the <code>hier(7)</code> [[man page]] since [[Version 7 Unix]];<ref name="v7">{{man|7|hier|v7}}</ref> subsequent versions, derivatives and clones typically have a similar man page.<ref>{{man|7|hier|FreeBSD}}</ref><ref name="openbsd">{{man|7|hier|OpenBSD}}</ref><ref>{{cite web|title=hier(7) man page for 2.9.1 BSD|url=http://www.freebsd.org/cgi/man.cgi?query=hier&manpath=2.9.1+BSD}}</ref><ref>{{cite web|title=hier(7) man page for ULTRIX 4.2|url=http://www.freebsd.org/cgi/man.cgi?query=hier&manpath=ULTRIX+4.2}}</ref><ref>{{cite web|title=hier(7) man page for SunOS 4.1.3|url=http://www.freebsd.org/cgi/man.cgi?query=hier&manpath=SunOS+4.1.3}}</ref><ref>{{man|7|hier|Linux}}</ref>
 
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 [[UNIX System V|System V]] [[Application Binary Interface]], the [[Intel Binary Compatibility Standard]], the Common Operating System Environment, and [[Linux Foundation]]'s [[Filesystem Hierarchy Standard]] (FHS).<ref>{{cite web |title=Where to Install My Products on Linux? |url=http://www.linuxjournal.com/article/4121 |website=[[Linux Journal]] |date=1 November 2000 |author=George Kraft IV |accessdateaccess-date=13 November 2014}}</ref>
 
Here is a generalized overview of common locations of files on a Unix operating system:
Line 51:
|
:<code>/etc</code>
|Contains system-wide configuration files and system databases; the name stands for ''[[et cetera]]''.<ref name="upe">{{cite book |first1=Brian W. |last1=Kernighan |authorlink1author-link1=Brian Kernighan |first2=Rob |last2=Pike |authorlink2author-link2=Rob Pike |title=The UNIX Programming Environment |publisher=Prentice-Hall |year=1984 |pages=[https://archive.org/details/unixprogramminge0000kern/page/63 63–65]|title-link=The UNIX Programming Environment |bibcode=1984upe..book.....K }}</ref> Originally also contained "dangerous maintenance utilities" such as <code>init</code>,<ref name="v7"/> but these have typically been moved to <code>/sbin</code> or elsewhere. Needs to be on the root filesystem itself.
|-
|
:<code>/home</code>
|Contains user home directories on Linux and some other systems. In the original version of Unix, home directories were in <code>/usr</code> instead.<ref name="notes72">{{cite web|last=Ritchie|first=Dennis|title=Unix Notes from 1972|url=https://www.bell-labs.com/usr/dmr/www/notes.html|accessdateaccess-date=14 January 2018}}</ref> Some systems use or have used different locations still: [[macOS]] has home directories in <code>/Users</code>, older versions of BSD put them in <code>/u</code>, [[FreeBSD]] has <code>/usr/home</code>.
|-
|
Line 115:
|
::<code>/libexec</code>
|Holds programs meant to be executed by other programs rather than by users directly. E.g., the [[Sendmail]] executable may be found in this directory.<ref>{{cite web |url=http://docs.cray.com/books/S-2341-22/html-S-2341-22/z1028736068smg.html |website=[[UNICOS]]/mp Networking Facilities Administration |publisher=[[Cray]] |title=Chapter 7. sendmail |accessdateaccess-date=14 September 2013}}</ref> Not present in the FHS until 2011;<ref>{{cite web |url=http://bzr.linuxfoundation.org/loggerhead/lsb/devel/fhs-spec/revision/44 |title=fhs-spec revision 44}}</ref> Linux distributions have traditionally moved the contents of this directory into <code>/usr/lib</code>, where they also resided in 4.3BSD.
|-
|