Linux Directory Structure explained๐งตโ
The Linux Directory Structure is a hierarchical system for organizing Linux directories and files. The Filesystem Hierarchy Standard defines this structure (FHS)
However, some directories in Linux file systems are not yet defined by the standard.
However, some directories in Linux file systems are not yet defined by the standard.
If you're new to Linux or switching from Windows, the Linux file system structure may appear strange and cryptic. C: and other drive letters are no longer available and have been replaced by /.
/- ๐ง๐ต๐ฒ ๐ฟ๐ผ๐ผ๐ ๐ฑ๐ถ๐ฟ๐ฒ๐ฐ๐๐ผ๐ฟ๐
The top of the directory structure is the root directory, which is represented by a forward slash (/). The root directory contains the directories and files that make up the Linux system.
The top of the directory structure is the root directory, which is represented by a forward slash (/). The root directory contains the directories and files that make up the Linux system.
You may have come across some internet jokes that mention "rm -rf /." In Linux, the rm command is used to delete files and directories.
With rm -rf /, you are simply instructing your system to delete the contents of the root directory forcefully and recursively. Because the root directory contains everything, you end up deleting everything and your Linux system. So Use this command with caution.
/๐ฏ๐ถ๐ป - ๐๐ถ๐ป๐ฎ๐ฟ๐ถ๐ฒ๐
The '/bin' directory contains the majority, if not all, of the machine's programs or applications, such as cd, cat, ls, and so on. The majority of the programs are in binary format and are accessible to all Linux users.
The '/bin' directory contains the majority, if not all, of the machine's programs or applications, such as cd, cat, ls, and so on. The majority of the programs are in binary format and are accessible to all Linux users.
/๐ฏ๐ผ๐ผ๐ - ๐๐ผ๐ผ๐ ๐ณ๐ถ๐น๐ฒ๐
This is an important folder in Linux because it contains all of the files required by the OS to boot, i.e. the boot loaders, such as the file grub.conf found in the grub directory, as well as the set of vmlinuz, initrd, s and kernel related files.
This is an important folder in Linux because it contains all of the files required by the OS to boot, i.e. the boot loaders, such as the file grub.conf found in the grub directory, as well as the set of vmlinuz, initrd, s and kernel related files.
/๐ฑ๐ฒ๐ - ๐๐ฒ๐๐ถ๐ฐ๐ฒ ๐ณ๐ถ๐น๐ฒ๐
This isย where all your devices live.ย ย You'll find your hardware, such as your keyboard, mouse, andย printer. A ย disk, for example, would be found as /dev/sda, and a partition on that disk would be found as /dev/sda1.
This isย where all your devices live.ย ย You'll find your hardware, such as your keyboard, mouse, andย printer. A ย disk, for example, would be found as /dev/sda, and a partition on that disk would be found as /dev/sda1.
/๐ฒ๐๐ฐ โ ๐๐ผ๐ป๐ณ๐ถ๐ด๐๐ฟ๐ฎ๐๐ถ๐ผ๐ป ๐ณ๐ถ๐น๐ฒ๐
The /etc directory houses the system's core configuration files, which are primarily used by the administrator and services, such as the password file, hostnamesย and networking files.
The /etc directory houses the system's core configuration files, which are primarily used by the administrator and services, such as the password file, hostnamesย and networking files.
/๐ต๐ผ๐บ๐ฒ โ ๐จ๐๐ฒ๐ฟ ๐ฝ๐ฒ๐ฟ๐๐ผ๐ป๐ฎ๐น ๐ฑ๐ฎ๐๐ฎ
In Linux, each user is assigned a directory that only they and the system administrator can access. This is the location where you keep your personal files, install programs, and save documents.
In Linux, each user is assigned a directory that only they and the system administrator can access. This is the location where you keep your personal files, install programs, and save documents.
In Linux, the HOME directory also contains your personal configuration files, also known as dot files (a dot precedes the name of the file). '
These are typically 'hidden,' and in order to see them, you must enable the appropriate option in your file manager or run the command ls with the -a switch in the terminal.
Assume you have two users on your Linux system, Jerry and Jimmy. They'll have their own home directories at /home/jerry and /home/jimmy respectively.
/๐น๐ถ๐ฏ โ ๐ฆ๐ต๐ฎ๐ฟ๐ฒ๐ฑ ๐น๐ถ๐ฏ๐ฟ๐ฎ๐ฟ๐ถ๐ฒ๐
The kernel modules and shared library files required by the system's boot operation can be found in the /lib directory. The extension *.so makes libraries easily identifiable.
The kernel modules and shared library files required by the system's boot operation can be found in the /lib directory. The extension *.so makes libraries easily identifiable.
In Windows, the equivalent would be a dynamically linked library or DLL.
/๐บ๐ฒ๐ฑ๐ถ๐ฎ - ๐ ๐ผ๐๐ป๐ ๐ฝ๐ผ๐ถ๐ป๐ ๐ณ๐ผ๐ฟ ๐ฟ๐ฒ๐บ๐ผ๐๐ฎ๐ฏ๐น๐ฒ ๐บ๐ฒ๐ฑ๐ถ๐ฎ
media directory contains sub-directories in which removable media such as cdroms and USB keys can be mounted on by theย system. You can access the content of the removable media from this directory.
media directory contains sub-directories in which removable media such as cdroms and USB keys can be mounted on by theย system. You can access the content of the removable media from this directory.
/๐บ๐ป๐ - ๐ ๐ผ๐๐ป๐ ๐ฑ๐ถ๐ฟ๐ฒ๐ฐ๐๐ผ๐ฟ๐
The /mntย directory, like the previously mentioned media folder, is where you (or the system administrator) manually mount devices or filesystems. Mounting is the process of making a filesystem available to the operating system.
The /mntย directory, like the previously mentioned media folder, is where you (or the system administrator) manually mount devices or filesystems. Mounting is the process of making a filesystem available to the operating system.
/๐ผ๐ฝ๐ โ ๐ข๐ฝ๐๐ถ๐ผ๐ป๐ฎ๐น ๐๐ผ๐ณ๐๐๐ฎ๐ฟ๐ฒ
In Linux, the /opt directory is an optional folder that usually contains manually installed software and vendor add-on packages (.i.e not part of the original installation).
In Linux, the /opt directory is an optional folder that usually contains manually installed software and vendor add-on packages (.i.e not part of the original installation).
/๐ฝ๐ฟ๐ผ๐ฐ โ ๐ฃ๐ฟ๐ผ๐ฐ๐ฒ๐๐ ๐ฎ๐ป๐ฑ ๐ธ๐ฒ๐ฟ๐ป๐ฒ๐น ๐ณ๐ถ๐น๐ฒ๐
The directory '/proc' contains information about currently running processes and kernel parameters. A number of tools use the content of the proc directory to obtain runtime system information.
The directory '/proc' contains information about currently running processes and kernel parameters. A number of tools use the content of the proc directory to obtain runtime system information.
In Linux, for example, if you want to check processor information, you can simply navigate to the file /proc/cpuinfo. If you want to see how much memory your Linux system is using, look at the contents of the /proc/meminfo file.
/๐ฟ๐ผ๐ผ๐ โ ๐ง๐ต๐ฒ ๐ต๐ผ๐บ๐ฒ ๐ฑ๐ถ๐ฟ๐ฒ๐ฐ๐๐ผ๐ฟ๐ ๐ผ๐ณ ๐๐ต๐ฒ ๐๐๐ฒ๐ฟ
There is also a /root directory, which serves as the root user's home directory. So, instead of /home/root, root's home is at /root. It should not be confused with the root directory (/).
There is also a /root directory, which serves as the root user's home directory. So, instead of /home/root, root's home is at /root. It should not be confused with the root directory (/).
/๐๐ฏ๐ถ๐ป โ ๐ฆ๐๐๐๐ฒ๐บ ๐ฏ๐ถ๐ป๐ฎ๐ฟ๐ถ๐ฒ๐
This is similar to the /bin directory. The only distinction is that it contains binaries that can only be executed by root or a sudo user.
This is similar to the /bin directory. The only distinction is that it contains binaries that can only be executed by root or a sudo user.
/๐๐บ๐ฝ โ ๐ง๐ฒ๐บ๐ฝ๐ผ๐ฟ๐ฎ๐ฟ๐ ๐ณ๐ถ๐น๐ฒ๐
This directory, as the name implies, stores temporary files. This directory is used by many applications to store temporary files. You can also use a directory to store temporary files.
This directory, as the name implies, stores temporary files. This directory is used by many applications to store temporary files. You can also use a directory to store temporary files.
However, keep in mind that the contents of the /tmp directories are deleted when your system restartsย so don't store anything important here.
/๐๐๐ฟ โ ๐จ๐๐ฒ๐ฟ ๐ฏ๐ถ๐ป๐ฎ๐ฟ๐ถ๐ฒ๐ ๐ฎ๐ป๐ฑ ๐ฝ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ ๐ฑ๐ฎ๐๐ฎ
Here you can find executable files, libraries, source of most of the system programs.
Here are some examples of directories contained in the /usr directory
- โ/usr/binโ contains basic user commands
Here you can find executable files, libraries, source of most of the system programs.
Here are some examples of directories contained in the /usr directory
- โ/usr/binโ contains basic user commands
- โ/usr/sbinโ contains administrator-specific commands.
- โ/usr/libโ contains the system libraries
- โ/usr/shareโcontains documentation or files that are shared by all libraries, such as '/usr/share/man', which contains the text of the manpages.
- โ/usr/libโ contains the system libraries
- โ/usr/shareโcontains documentation or files that are shared by all libraries, such as '/usr/share/man', which contains the text of the manpages.
/๐๐ฎ๐ฟ - ๐ฉ๐ฎ๐ฟ๐ถ๐ฎ๐ฏ๐น๐ฒ ๐ฑ๐ฎ๐๐ฎ ๐ณ๐ถ๐น๐ฒ๐
'/var' contains variable data that is expected to grow in size (such as system logging files, printer spool directories, mail, and so on).
'/var' contains variable data that is expected to grow in size (such as system logging files, printer spool directories, mail, and so on).
For example:
โ /var/crash stores information about crashed processes.
โ /var/log contains log files for the system as well as other applications.
โ /var/lib contains dynamic data files/libraries.
โ /var/spool spool data of applications
โ /var/mail Contains user mailbox files
โ /var/crash stores information about crashed processes.
โ /var/log contains log files for the system as well as other applications.
โ /var/lib contains dynamic data files/libraries.
โ /var/spool spool data of applications
โ /var/mail Contains user mailbox files
/๐๐ฟ๐ โ ๐ฆ๐ฒ๐ฟ๐๐ถ๐ฐ๐ฒ ๐ฑ๐ฎ๐๐ฎ
This is the service directory, which stores service data. If you run a server, such as a web server or FTP server, the files that will be accessed by external users would be stored in /srv/.
This is the service directory, which stores service data. If you run a server, such as a web server or FTP server, the files that will be accessed by external users would be stored in /srv/.
This should be enough information to help you understand the Linux directory structure and how to use it.
That's it! Thank you for making it this far. Hopefully you will find this thread useful.
That's it! Thank you for making it this far. Hopefully you will find this thread useful.
Check me out @xtremepentest if you liked this thread!! I'm gonna be tweeting more about Linux, networking, security etc.
Loading suggestions...