# Day 5: Linux - File System Hierarchy

Here's a comprehensive list of the file hierarchy in Linux:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689513983982/8103418f-889a-48e5-911f-f0f5fa7a8ea0.png align="center")

📂 /: The root directory, also known as the top-level directory. All other directories are organized within it.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689516978384/14117cae-a97b-4892-a3e1-9fc47b6845b7.png align="center")

📂 /bin: Essential user binaries (executable programs) available to all users. Examples include `/bin/ls` (list files), `/bin/cp` (copy files), and `/bin/rm` (remove files).

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689517039023/6bd791d9-8ab7-495c-971d-65f9d46e448c.png align="center")

📂 /boot: Boot loader and kernel files used during system booting. Examples of files found here include the Linux kernel (`/boot/vmlinuz`) and boot configuration files (`/boot/grub` in some distributions).

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689517111173/d29e53a7-3d82-4cd4-b4d3-392e505d089e.png align="center")

📂 /dev: Device files representing hardware devices on the system. Examples include `/dev/sda` (hard drive), `/dev/ttyUSB0` (USB serial device), and `/dev/null` (a special file that discards data written to it).

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689517235689/2bf59c3a-a4ed-4fb3-9fb5-226c92325352.png align="center")

📂 /etc: System-wide configuration files. Examples include `/etc/passwd` (user account information), `/etc/hosts` (mapping of hostnames to IP addresses), and `/etc/apt/sources.list` (package repository configuration in Debian-based systems).

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689517319553/a0e410aa-929b-4cb2-8f07-c1757d180f66.png align="center")

📂 /home: Home directories for regular users. For example, if the username is "john," their home directory would be `/home/john`. Each user typically has their own directory here to store personal files and configurations.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689517503046/d205c140-765b-479d-b8ed-5635f4296e98.png align="center")

📂 /lib: Shared libraries needed by programs in /bin and /sbin. Examples include `/lib/libc.so` (C library), `/lib/libm.so` (math library), and `/lib/ld-linux.so` (dynamic linker/loader).

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689517536921/9aa557b8-f151-427a-8a24-a4d9923b40a7.png align="center")

📂 /media: Mount point for removable media devices like USB drives. When you insert a USB drive, it may appear under `/media` with a name like `/media/usb`.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689517656383/95b6278c-4f35-421d-8ec1-fed0b739e816.png align="center")

📂 /mnt: Mount point for temporarily mounted file systems. For example, if you mount a network share or an external drive, it might be accessible under `/mnt`.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689517679743/80089359-e6ea-453a-ab72-1f3d1d3ce345.png align="center")

📂 /opt: Optional software packages installed by the system administrator. Examples of software installed here might include `/opt/mysql` (MySQL database server) or `/opt/anaconda` (Anaconda Python distribution).

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689517727370/e6d7fac4-0c61-47e9-9d7b-0cd16f8bcbc3.png align="center")

📂 /proc: A virtual file system providing information about running processes and system status. For example, you can find details about the CPU (`/proc/cpuinfo`) or view running processes (`/proc/[PID]/status`).

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689517831084/e8c36aa9-d043-4cef-9e9f-ff1a3e7b549c.png align="center")

📂 /root: The `/root` directory serves as the home directory for the root user, which is the superuser or administrator of the system.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689517892443/df2bfa41-165d-455e-8223-ebb03f83e6c4.png align="center")

📂 /run: Runtime files and process information relevant to the current boot. It may include files like `/run/utmp` (user login records) or `/run/systemd` (systemd runtime files in some distributions).

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689517936713/10598d20-c3f2-483a-940b-7c0492c906ab.png align="center")

📂 /sbin: System binaries (executable programs) for system administration tasks. Examples include `/sbin/reboot` (reboot the system), `/sbin/ifconfig` (configure network interfaces), and `/sbin/fsck` (filesystem check).

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689517986880/91cbaab3-eba6-4e57-af5f-20677519046a.png align="center")

📂 /srv: Data files for services provided by the system. For example, web servers may store website files under `/srv/www` or file servers may store shared files under `/srv/samba`.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689518053766/c803b77f-223e-4f8f-a7e1-83294cf5057b.png align="center")

📂 /sys: A virtual file system that exposes kernel data structures. For instance, you can find information about the CPU (`/sys/devices/system/cpu`) or control system features (`/sys/class`).

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689518099513/1b919a6d-612e-468d-bc8c-4ca577daeef1.png align="center")

📂 /tmp: Temporary files that are cleared upon system reboot. It's typically used for storing temporary data by various programs and processes.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689518161643/1242fd86-61d3-40fd-a888-31efcdc7d55e.png align="center")

📂 /usr: Secondary hierarchy containing user utilities, libraries, and documentation. Examples of user utilities in `/usr/bin` include `/usr/bin/gcc` (GNU Compiler Collection), `/usr/bin/python` (Python interpreter), and `/usr/bin/zip` (compression utility).

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689518192584/2ad36eb3-5f4d-43f6-ae58-61257fd4d6b7.png align="center")

📂 /var: Variable files such as log files, spool directories, and temporary files. Log files are stored in `/var/log` and can include files like `/var/log/syslog` (system log) or `/var/log/auth.log` (authentication log).

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689518250229/2eac1c10-4a9b-407b-99b8-09f27712477d.png align="center")

This list covers the main directories in the Linux file hierarchy. Each directory has its purpose and contains specific types of files essential for system operation, user applications, and configuration. Understanding the file hierarchy helps navigate and manage the Linux system effectively.
