DEV Community

Cover image for Linux File System😉

Linux File System😉

What is the Linux File System?

Linux file system is generally a built-in layer of a Linux operating system used to handle the data management of the storage. It helps to arrange the file on the disk storage. It manages the file name, file size, creation date, and much more information about a file.

A Linux file system is a structured collection of files on a disk drive or a partition. A partition is a segment of memory and contains some specific data. In our machine, there can be various partitions of the memory. Generally, every partition contains a file system.

Hierarchical Tree Structure. Root folder comes first and then files are under root respectively.


Linux File System Overview:-


  • / or /root: root user's home directory which is separate from other users
  • /home: contains home directories of all non-root users.
  • /bin(stands for binaries): executables for most essential user commands(all files are system-wide usable)

What is binary?

Computer readable format (just 0's & 1's)

  • /sbin(system binaries): essential system binaries, programs that admin would use(need superuser priviledge)
  • /lib, /lib32, /lib64, /libx32: essential shared libraries that executables from /bin or /sbin use.
  • /usr(user): this was used for user home or directories(contains the same /bin, /sbin, /lib folders).

Why /usr contain these folders?

  • historic reasons(as UNIX also had those splits)
  • Because of storage limitations it was split to root binary folders ad user binary folders.

When we execute basic Linux commands they are executed from /usr/bin folder
In other distros, /bin or /sbin contains less commands & /usr/bin or /sbin contains all other commands.

Inside /usr, there is a folder /local which also contains same files as /usr(/bin or /sbin or /lib).

  • /usr/local: programs that you install on the computer. Third-party applications like docker, minikube, ..... goes here. Programs installed here will be available for all users on the computer.

Note:- If you want to install third-party applications & don't want to be accessed by all the other users then you install them in your own /home directory.

  • /boot(booting): contains files required for booting.

  • /opt(optional): third-party programs you install(all programs will be available system-wide).

Difference between /usr/local & /opt:-

  • /usr/local: programs which splits into its components.
  • /opt: programs which not splits into its components.

Note:- Till now all folders are Read-Only folders.

  • /etc(et cetera): a place where the configuration for system-wide applications is stored.
  • originally for etc(means everything else goes there).
  • emerged into the main configuration location.
  • /dev(devices): location of device files- like webcam, keyboard, hard drives, etc. Apps and Drivers will access this, NOT the user.
  • /var(variable): contains files to which the system writes data during the course of its operation.
  • /var/log:- contains log files.
  • /var/cache:- contains cached data from application programs.
  • /tmp(temporary): temporary resources required for some process, kept here temporarily.
  • /media(removable media): contains subdirectories where removable media devices inserted into the computer are mounted. Eg; when you insert a CD, a directory will automatically be created & you can access the contents of the CD inside the directory.
  • /mnt(temporary mount points): historically, sysadmins mounted temporary file systems there(or manually mounting folders).

Interacting with these folders:-

Usually, you are not interacting with these folders. Installing apps with a package manager(Installer or package manager is handling this).

Hidden Files:-


  • It is primarily used to help prevent important data from being accidentally deleted.
  • Automatically generated by programs or operating systems.
  • File name starts with "."(dot).
  • In UNIX, it is also called 'dotfiles'.

Discussion (0)