Linux FileSystemHierarchyStandard
Overview
Trying out Ubuntu and other Linux distributions, I have been struggling on the file system hierarchy. Time to refresh my memories with some researches.
FHS : Filesystem Hierarchy Standard
This is a standardization attempt on the file system layout.
Folder | Description |
---|---|
/ | Root of the file system tree. |
/bin | Binaries : contains foundamental commands and basic tools. |
/boot | Boot : contains files required to start the system. Should not be modified. |
/dev | Devices : virtual directory that contains all files related to devices. Those files are generated during the installation or at runtime for plug and play devices (USB, …) |
/etc | Et cetera : Dumping location, system-wide configuration files or system databases. Initially created for anything that would not fit in the other folders. |
/home | Home Directory : all files related to users (documents, pictures, etc…). |
/lib | Libraries : contains all libraries or dependencies necessaries for the binaries in /bin and /sbin . It contains the important kernel modules, like drivers for all the peripherals (soundcard, wifi, … ). Linux distributions may have variants /lib32 and /lib64 for multi-architecture support. |
/media | Media : Default mount point for removable devices (usb sticks, CD Rom, …). |
/mnt | Mount : Temporarily mounted filesystems. |
/opt | Optional add-on software packages. It can also be used to contain locally build software. It would also contains bin and lib subfolders. Nowadays /usr/local is prefered to /opt . |
/proc | Process : virtual directory that contains information about the computer such as cpu, memory, OS version , … |
/root | Superuser home directory. Always on the initial filesystem to make sure it is always available during maintenance periods. |
/run | Temporary folder : contains volatile runtime data. |
/sbin | System Binaries : (or superuser binaries) contains fundamental utilities such as init required to start, maintain or recover the system. Requires the use of superuser or sudo . |
/srv | Server data : can be used to host html pages served through a web server or files hosted by an sftp server. In that case subfolders are created, like /srv/www and /srv/ftp . |
/sys | System : virtual directory that contains information only on devices connected to the computer. Touch with care as it may crash the system. |
/tmp | Temp : contains temporary files used by applications running by the users. Normally should be cleaned up upon startup. |
/unix | Unix kernel : contains kernel files for Research Unix and System V. Sometime can be used also for the virtual memory. |
/usr | User File System : holds executables, libraries and shared ressources that are not system critical (Window managers, scripting languages, …). |
/usr/bin | User Binaries. |
/usr/include | Include files : Headers files used mostly when developping in C. |
/usr/lib | User Libraries. |
/usr/libexec | Library Executables : Contains executable that are executed by other programs rather than directly by users. |
/usr/local | Additions for the operating systems (that are not part of it). |
/usr/share | Program Data : Architecture-Independent data contained in subdirectories. For instace, man subdirectory will contain content for manpage. |
/var | Variable : contains file that can change over time, such as logs, spool, etc… |
/var/log | Logs. |
/var/mail | Mail location for all incoming emails. |
/var/spool | Spool directory : contains print jobs, or other queued tasks. |
/var/src | Source : contains uncompiled code for some programs. |
/var/tmp | contains temporary files that should be preserved between reboots. |
Utilities
Command | Description |
---|---|
cd | Change Directory, used to navigate |
mkdir | Make Directory, to create a new directory |
pwd | Print Current Directory |
rmdir | Remove Directory, to delete an empty directory |
tree | Nice tool to visualize the hierarchy in a Terminal window. |