Play this article
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
/root/
/root/ is the root user's home directory
/home/
/home/ contains the home directory of all non-root users
/home/username
the home directory of a particular user. By default, it contains folders like Desktop, Documents, Downloads, Music, Pictures, Template, Videos.
- 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.
- 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.
- 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.
- essential shared library that executable from /bin/ or /sbin/
/usr/
/usr/ was used for user home directories.
- 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
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
/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
/boot/
- booting - contains files required for booting
/etc/
- etcetera - contains configuration files for system-wide applications
- It contains system configurations, network configurations, user data, and passwords
/dev/
- devices - contains device files for devices like webcam, keyboard, hard disk etc
- Applications and Drivers will access this directory NOT the user
/var/
- variable - contains files to which the system writes data during the course of its operation
- /var/log/ - contains log file
- /var/cache / - contains cache 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
/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