Basics of Linux File System Heirarchy

Reading Time : ~ .

FHS:

In 1994, FHS(Fileystem Hierarchy Standard) was proposed, it describes the directory structure of UNIX and UNIX-like systems(Linux). Before FHS was proposed, there had been UNIX-like operating systems which had their own standards. Today almost every UNIX-like systems notable Linux distros follow these guidelines.

The most common file hierarchy structure looks as below:

/
  /bin
  /boot
  /dev
  /etc
  /usr
  /tmp
  /lib
  /proc
  /opt
  /sbin
  /mnt
  /var
  /root

root(/):
This is the primary direcotry, All the directories reside in this directory. The partition which the root file system resides on is mounted first during boot and the system will not boot if it doesn't find it.

/bin:
This directory contains binary files of fundamental utilities like mv, ls, cp etc.. commands. 

/boot    
The startup files and the kernel, vmlinuz. In some recent distributions also grub data. Grub is the GRand Unified Boot loader and is an attempt to get rid of the many different boot-loaders we know today.

/dev    
Contains references to all the CPU peripheral hardware, which are represented as files with special properties. We can interact with these in the same way as normal files, so finding out a keyboard device file and piping in its specific code will resemble a key press. This is the best way to simulate user input like keyboard, mouse etc..

/etc    
Contains system configuration files, change to these files will be reflected to all users. For user specific configuration modify the ‘.config’ directory present in user home directory.

/home    
This is the home directory where user data is stored. Each user gets a directory with directory name as user name.

/lib    
Library files, includes files for all kinds of programs needed by the system and the users.

/lost+found    
Every partition has a lost+found in its upper directory. Files that were saved during failures are here.

/mnt    
Standard mount point for external file systems, e.g. a CD-ROM or a digital camera.

/opt    
Third party software files will be stored here.

/proc    
A virtual file system containing information about system resources. Most commands like ‘top’, ‘ps’ etc..parse the files present in /proc to get processes information.

/root    
Home directory of root user. This is different from ‘/’ which is referred as root directory.

/sbin    
Programs for use by the system and the system administrator.

/tmp    
Temporary space for use by the system, cleaned upon reboot, so don't use this for saving any work!

/usr    
Programs, libraries, documentation etc. for all user-related programs.

/var    
Storage for all variable files and temporary files created by users, such as log files, the mail queue, the print spooler area, space for temporary storage of files downloaded from the Internet, or database specific data.

Tip:
We can simply backup the whole filesystem excluding the /proc, /tmp and /dev as they are irrelevant on every boot. To backup the system it’s better to use ‘rsync’ command which has features to compress, doesn’t alter permissions etc..

rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /path/to/backup/folder
    By Posted On
SENIOR DEVELOPER at MICROPYRAMID

Need any Help in your Project?Let's Talk

Latest Comments
Related Articles
How to create Custom User Model in Django? Chaitanya Kattineni

Django provides built in authentication which is good for most of the cases, but you may have needs that are being served with the existing ...

Continue Reading...
Imageview customization (circular image view) Chaitanya Kattineni

In android designing we'll come across ImageView. An ImageView displays an arbitrary image, such as an icon. The ImageView class can load images from various ...

Continue Reading...
How to develop RESTful webservice in Django using djangorestframework? Chaitanya Kattineni

DjangoRestFramework is widely used to develop restful API. DjangoRestFramework is easy to use who are familiar with Django, as it is developed on the core ...

Continue Reading...

Subscribe To our news letter

Subscribe to our news letter to receive latest blog posts into your inbox. Please fill your email address in the below form.
*We don't provide your email contact details to any third parties