Linux File System

Linux File System

ยท

3 min read

Linux File System

In Linux, the File system is in a hierarchical tree structure. It contains one root folder ( / ). In Linux, data is stored in formats like EXT3, EXT4, BTRFS, XFS, and so on

Filestructure.png

/root/

/root/ is the root user's home directory

root.png

/home/

/home/ contains the home directory of all non-root users

home.png

/home/username

the home directory of a particular user. By default, it contains folders like Desktop, Documents, Downloads, Music, Pictures, Template, Videos.

home prahlad.png

  • each user has its own space.
  • each user can have its own configuration.
  • multiple users can work on its computer
  • programs installed system-wide are available for all users on the computer

/bin/

/bin/ contains binaries.

bin.png

  • Executable for most essential user commands like cat, cp, echo,.., etc.,
  • there are all available system-wide
  • What are binaries? Computer-readable format

/sbin/

/sbin/ contains system binaries.

sbin.png

  • these binaries are different from /bin/ binaries
  • these commands are system-related
  • these commands need superuser privilege like adduser, etc
  • What are system binaries? essential system binaries. programs that admin would use (need superuser privilege )

/lib/

/lib/ contains libraries.

lib.png

  • essential shared library that executable from /bin/ or /sbin/

/usr/

/usr/ was used for user home directories.

usr.png

  • It contains folders like bin (same as /bin/ content), games, include, lib, lib32, lib64, lib, local, sbin (same as /sbin/ content), share, src
  • because of storage limitations it was split to the root binary folder and usr binary folder
  • split doesn't make sense now, as the concept stays the same

/usr/local/

  • programs installed here, will be available for all users on the computer
  • program which splits its components are installed here

usr local.png

For example we installed java

  • binary files goes to /usr/local/bin
  • library files goes to /usr/local/lib
  • documentation
  • configuration

/home/

programs installed here are available for specific users only

home.png

/opt/

  • optional - third party programs that we install
  • empty for a new install
  • available to all users
  • mostly code editors and web browsers installed in /opt/ directory
  • program which wont splits its components are installed here

opt.png

/boot/

  • booting - contains files required for booting

boot.png

/etc/

  • etcetera - contains configuration files for system-wide applications
  • It contains system configurations, network configurations, user data, and passwords

etc.png

/dev/

  • devices - contains device files for devices like webcam, keyboard, hard disk etc
  • Applications and Drivers will access this directory NOT the user

dev.png

/var/

  • variable - contains files to which the system writes data during the course of its operation

var.png

  • /var/log/ - contains log file
  • /var/cache / - contains cache data from application programs

/tmp/

  • temporary - temporary resources required for some process, kept here temporarily

tmp.png

/media/

  • removable media - contains subdirectories where removable media devices inserted into the computer are mounted

media.png

/mnt/

  • temporary mount points - historically sysadmins used to mount temporary files system here
  • to manually mount a device to the system then we use /mnt/ folder

mnt.png

Did you find this article valuable?

Support Prahlad Inala by becoming a sponsor. Any amount is appreciated!

ย