Linux: File System Hierarchy
In this tutorial is described Filesystem Hierarchy Standard (FHS), which specifies required directories. The root directory is “/” and it should contain only the subdirectories.
/bin
- Contains binaries which can be executed from the command line (ls, grep, mkdir…)
- Programs that can be used by users (system, admin, normal users)
- It can be in single-user mode
/boot
- Contains everything required for the boot process
- Kernel
- Grant Unified Boot-loader
- LILO (LInux LOader)
/sbin
- Binaries
- Program used by system and admin
- Normal users can use programs in /bin if they are allowed
- Usually, normal users do not have this directory in $PATH variable
/dev
- Files of all devices
- Created during installation operating system.
- Create new devices: /dev/MAKEDEV
| File | Description |
| Sda | First SCSI drive on the SCSI/SATA bus |
| md0 | First group of meta discs (RAID) |
| ttyS0 | First serial port |
| lp0 | First parallel printer |
| null | bin for bits |
| random | Deterministic random bits |
| urandom | Non-deterministic random bits |
/etc
| File | Description |
| passwd | Users information |
| fstab | Partition and storage mounting information |
| rc or rc.d or rcX.d | Run commands – commands that runs when OS starts |
/home
- The home directory for users
- All data and system settings of users
- Can be divided into groups (school, office, financial)
/root
- Home directory for user root
- Normal users don’t have permissions.
/lib
- Libraries for programs
- /lib/modules: kernel modules, network controls, file system control
/tmp
- Temporary files
- Used by running programs
/mnt
- Mounting temporary file systems
- File systems from /etc/fstab are mounted during start OS
- Network file systems
- /media: DVD, USB
/usr
- Programs, libraries installed from OS distribution
- Accessible for everyone
- /usr/
| Directory | Description |
| local | Software installed by admin on local device |
| X11R6 | Files of Windows OS |
| bin | Almost all commands for users |
| sbin | Usually server’s programs |
| include | Header files for C language |
| lib | Stable libraries |
- /usr/share/
| Directory | Description |
| X11 | Files of Windows OS |
| dict | Glossary |
| man | Manual pages |
| doc | Documentation |
| info | Information files |
| src | source files |
/var
Contains files that are changed when OS is running.
| Subdirectory | Description |
| log | Logging files |
| run | Run-time variable data |
| spool | Program using queue (mails, printers) |
| Mailbox | |
| local | variable data from /usr/local |
| lib | Holds dynamic data libraries/files |
| lock | Lock files. Indicates that resource (database, file) is in use and should not be accessed by another process. |
/opt
Third-party software
/proc
- Created by OS kernel
- Information about system
- Stored only in RAM
- Does not use any disc space
- Every process has a subdirectory (by PID)
| Subdirectory | Description |
| /PID/status | Stats about process |
| /PID/cmdline | How was the process started and what input arguments |
| /PID/maps | Region of contiguous virtual memory in a process or thread |
| /PID/environ | Environment of process |
- Interesting files
| File | Description |
| cpuinfo | Information about CPU |
| meminfo | Usage of memory |
| version | Kernel version |
| cmdline | Kernel’s parameters from the boot loader |
| devices | List of drivers for the kernel |
| interrupts | Which interrupts are used and how many times |
| ioports | list of currently registered port regions used for input or output communication. |
| dma | ISA Direct Memory Access channel |
| kcore | Image of physical system memory |
| cmdline | Kernel’s parameters from the boot loader |
| cmdline | Kernel’s parameters from the boot loader |
/lost+found
- Recovered or damaged data after a crash.
- Each partition has its own /last+found directory.