[fs.general] # 31 Input/output library [[input.output]](./#input.output) ## 31.12 File systems [[filesystems]](filesystems#fs.general) ### 31.12.1 General [fs.general] [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13115) Subclause [[filesystems]](filesystems "31.12 File systems") describes operations on file systems and their components, such as paths, regular files, and directories[.](#1.sentence-1) [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13119) A [*file system*](#def:file_system "31.12.1 General [fs.general]") is a collection of files and their attributes[.](#2.sentence-1) [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13123) A [*file*](#def:file "31.12.1 General [fs.general]") is an object within a file system that holds user or system data[.](#3.sentence-1) Files can be written to, or read from, or both[.](#3.sentence-2) A file has certain attributes, including type[.](#3.sentence-3) File types include regular files and directories[.](#3.sentence-4) Other types of files, such as symbolic links, may be supported by the implementation[.](#3.sentence-5) [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13130) A [*directory*](#def:directory "31.12.1 General [fs.general]") is a file within a file system that acts as a container of directory entries that contain information about other files, possibly including other directory files[.](#4.sentence-1) The [*parent directory*](#def:parent_directory "31.12.1 General [fs.general]") of a directory is the directory that both contains a directory entry for the given directory and is represented by the dot-dot filename ([[fs.path.generic]](fs.path.generic "31.12.6.2 Generic pathname format")) in the given directory[.](#4.sentence-2) The [*parent directory*](#def:parent_directory "31.12.1 General [fs.general]") of other types of files is a directory containing a directory entry for the file under discussion[.](#4.sentence-3) [5](#5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13143) A [*link*](#def:link "31.12.1 General [fs.general]") is an object that associates a filename with a file[.](#5.sentence-1) Several links can associate names with the same file[.](#5.sentence-2) A [*hard link*](#def:hard_link "31.12.1 General [fs.general]") is a link to an existing file[.](#5.sentence-3) Some file systems support multiple hard links to a file[.](#5.sentence-4) If the last hard link to a file is removed, the file itself is removed[.](#5.sentence-5) [*Note [1](#note-1)*: A hard link can be thought of as a shared-ownership smart pointer to a file[.](#5.sentence-6) — *end note*] A [*symbolic link*](#def:symbolic_link "31.12.1 General [fs.general]") is a type of file with the property that when the file is encountered during pathname resolution ([[fs.class.path]](fs.class.path "31.12.6 Class path")), a string stored by the file is used to modify the pathname resolution[.](#5.sentence-7) [*Note [2](#note-2)*: Symbolic links are often called symlinks[.](#5.sentence-8) A symbolic link can be thought of as a raw pointer to a file[.](#5.sentence-9) If the file pointed to does not exist, the symbolic link is said to be a “dangling” symbolic link[.](#5.sentence-10) — *end note*]