Linux: File system hierarchy

Quick How To Guide

In this tutorial is described Filesystem Hierarchy Standard (FHS), which specifies required directories. The root directory is "/" and it should contains only the subdirectories.

/bin

  • Contains binaries which can be executed from 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 ssytem and admin
  • Normal users can used programs in /bin if they are allowed
  • Usually normal users does 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

  • Home directory for users
  • All data and system settings of users
  • Can be divided to 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)
mail 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 subdirectory (by PID)
    Subdirectory Description
    /PID/status Stats about process
    /PID/cmdline How was 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 boot loader
    devices List of drivers for 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 boot loader
    cmdline Kernel's parameters from boot loader

/lost+found

  • Recovered or damaged data after crash.
  • Each partition has own /last+found directory

Was this information helpful to you? You have the power to keep it alive.
Each donated € will be spent on running and expanding this page about UNIX Shell.