Linux file system

Linux file system layout

  • FHS standard (Filesystem Hierarchy Standard) ensures that every Linux has the same file system layout
  • In other words this standard defines the location of the most essential Linux files and directories
  • FHS makes it easier to
    • keep Linux systems compatible with each other and
    • manage, use and develop Linux regardless which Linux distribution is used
  • Files stored in the file system may include programs, databases, pictures, music, documents etc.
  • Linux file system is very different compared to Windows file system
  • While in Windows operating system each drive must have a unique drive letter (C:\, D:\ etc.) in Linux the whole file system is based on the root directory (/)
  • Important: File system root in Linux is different than the root user!
  • Below is the presentation of Linux file system layout including all essential directories

Linux file system layout

  • All directories presented in the figure above are listed and described in the following table
Directory Description
/ Directory on which all other directories are placed hierarchically
/dev System specific device files
/etc System specific configuration files (settings for operating system and programs)
/home User home directories
/boot Includes Linux kernel in binary format and boot loader files (grub)
/var Includes dynamic files, which are constantly edited (for example the log files). This folder can also include runtime data for some programs
/lost+found Directory for 'lost' files, which are created during system crash or harddrive malfunction
/lib Shared program libraries (similar to Windows DLL files)
/sbin Super user executable management commands (binaries)
/mnt Dedicated directory for external drives (optical and mass storage) like CD/DVD/Floppy/USB
/bin System basic executable management commands (binaries)
/usr Commands, libraries and documentation of system programs
  • Linux directory tree starting from the root (/) can be printed for example with ls -la / command like in the example below
testuser@ubuntu-PC:~$ ls -la /
total 620
drwxr-xr-x  1 root root    512 Feb 13  2019 .
drwxr-xr-x  1 root root    512 Feb 13  2019 ..
drwxr-xr-x  1 root root    512 Feb 13  2019 bin
drwxr-xr-x  1 root root    512 Jul 25  2018 boot
drwxr-xr-x  1 root root    512 Sep 30 08:16 dev
drwxr-xr-x  1 root root    512 Sep 30 08:16 etc
drwxr-xr-x  1 root root    512 Feb 13  2019 home
-rwxr-xr-x  1 root root 631968 Jan  1  1970 init
drwxr-xr-x  1 root root    512 Mar  9  2020 lib
drwxr-xr-x  1 root root    512 Jul 25  2018 lib64
drwxr-xr-x  1 root root    512 Jul 25  2018 media
drwxr-xr-x  1 root root    512 Feb 13  2019 mnt
drwxr-xr-x  1 root root    512 Mar  9  2020 opt
dr-xr-xr-x 10 root root      0 Sep 30 08:16 proc
drwx------  1 root root    512 Sep 30 12:39 root
drwxr-xr-x  1 root root    512 Sep 30 08:16 run
drwxr-xr-x  1 root root    512 Mar  9  2020 sbin
drwxr-xr-x  1 root root    512 Jul 19  2018 snap
drwxr-xr-x  1 root root    512 Jul 25  2018 srv
dr-xr-xr-x 12 root root      0 Sep 30 08:16 sys
drwxrwxrwt  1 root root    512 Sep 30 14:17 tmp
drwxr-xr-x  1 root root    512 Jul 25  2018 usr
drwxr-xr-x  1 root root    512 Sep  4  2019 var