For anyone, who is a beginner on working with Linux OS, might feel difficulty in understanding the file hierarchy structure and the purpose each directory serves.
So, I'm writing this because I felt the same.
This article will provide information of Linux file hierarchy structure, locations and its usability.
Linux Directory Structure Diagram
Each of the above directories contains important information. We will see this hierarchically.
1. /(Root)
- Primary root hierarchy and root directory of entire file system hierarchy
- /root is root user's home directory should not be confused with "/"
- Each directory and file starts from root directory
- Only root user has right to write under this directory
2. /bin
- Contains executable binary files
- Files requires to run as single-user mode
- Other essential commands like cat, ls, wc, tar, df, ping etc are located here
3. /boot
- Contains boot loader files required during boot up process
- Eg: Kernels, grub files
4. /device
- Contains device files that requires for hardware devices on the machine
- Eg: cpu, cdrom
5. /etc
- Host specific system-wide configuration files are available here
- Contains configuration files for individual programs
- Contains startup and shutdown script required to start/stop the individual programs
- Eg: /etc/resolv.conf
6. /home
- Home directory of users
- Every time when user is created, a directory in the name of user is created under this directory
- User can store their personal files
- Eg: /home/sathish
7. /lib
- Contains library files that required for /bin/ and /sbin/
- In simple words, these files are used by a program or command or process for proper execution
8. /media
- Mount points for removable devices such CD-ROM, USB etc.
- Temporary mount directory for removable devices
- /media/cdrom for CD-ROM; /media/floppy for floppy drives; /media/cdrecorder for CD writer
9. /mnt
- Temporarily mounted file systems
- Where sysadmins can mount file systems
10. /opt
- Optional software application software packages
- Contains 3rd party application software
- Eg: /opt/java
11. /sbin
- Contains essential system binaries
- Contains linux commands that are used by sysadmins
- Eg: iptables, reboot, fdisk, ifconfig, swapon
12. /srv
- srv stands for service
- Contains server specific and service related files
13. /tmp
- System's temporary directory
- Accessed by all users and root
- Store temporary file for users and system, available till next boot
14. /usr
- Secondary hierarchy for read-only user data
- Contains majority of multi-user utilities and application
- Contains binaries, libraries, documentation and source-code for second level programs
- User binaries that are unavailable in /bin, can be found under /usr/bin/ which contains user binaries
- System binaries that are unavailable in /sbin, can be found under /usr/sbin/ which contains system binaries
- /usr/lib contains binaries for /usr/bin and /usr/sbin files
- /usr/local contains user programs that installed from source
15. /proc
- Virtual and pseudo file system which contains all the running process with processid aka pid
16. /var
- Stands for variable
- This directory is expected to grow
- Contains logs, lock, spool and temp files
Hope the above information helps.
P.S. This is my first blog written. So, please be kind enough and feel free to point out the mistakes.
Top comments (0)