Banner of

Linux Directory Tree Structure


Category: Linux

Date: November 2021
Views: 2.18K


First is the root directory, which is often noted by a forward slash (/). This houses everything on your Linux system, and since Linux gives total control to its user. you can issue the following command: sudo rm -rf / to completely remove everything (AND I MEAN EVERYTHING) in your computer . WARNING: do not try this command in your computer!.

Next up is /bin, which contains all essential executable binaries that are required for a system to function in single-user mode. These executables aren't user applications, but essential commands that are used by the system (but can also be used by users), such as less and ip.

Next is /boot, which contains all the files required for the system to boot. You'll then find /dev, which contains several special device files, such as /dev/sda, which represent hardware and virtual devices.

The /etc directory is where all of the system-wide configuration files for applications and services are.

The /dev directory consists of files that represent devices that are attached to the local system. However, these are not regular files that a user can read and write to; these files are called devices files or special files. Device files are abstractions of standard devices that applications interact with via I/O system calls. They are representations of hardware devices.

The home directory, which is /home, houses all personal files and directories for the users. such as Music, Documents and Download directories, in my system for example I have this "/home/mosaid/Documents" directory which contains my documents

The /lib directory contains the library files (which are used by essential binaries).

There's also the /lost+found directory, which stores recovered files that are used in case of a system crash.

The /media directory contains all subdirectories for removable devices (such as external drives).

The /opt directory is for optional packages and serves as a common location for proprietary software that doesn't tend to follow the standard file system hierarchy.

System and process information files are stored in /proc.

The Root user home directory is isolated from home and is found in /root. the root user is called the super user, it has the highest prevelege in the linux system, when we want to install a program for instance we precede our command by the word "sudo" which means do this command as a super user

Applications can store transient files for sockets and process IDs in the /run directory.

The /sbin directory houses more executable binary files, but these are those that are used primarily for system administration.

The Service Data folder (/srv) is a location that houses data for services that are provided by the system (such as for the Apache webserver).

All temporary files are stored in /tmp and are deleted when the system is restarted.

User binaries (applications used only by the user and not by the system) are stored in /usr.

And finally, the /var directory houses all variable data files, such as log files (in /var/log) as well as the Apache document root (in /var/www/html/).

And here you have it, that was the linux filesystem and directory heirarchy. everytime you want to know your position in this directory tree you can use the command pwd which will print current directory and will let you know where you are.



2.18K views

Previous Article Next Article

0 Comments, latest

No comments.