In this article, let us review the Linux filesystem structures (linux essential root subdirectories) and understand the meaning of individual high-level directories.
- root contains every single file and directory starts from the root directory. Only root user has write privilege under this directory.
- bin contains binary programs (also known as an executable files), which are programs that are ready to run. Most of the basic Unix commands such as ls and cp are in /bin. However, some of the files in /bin are not in binary format because shell scripts perform the tasks of binaries in modern systems.
- dev contains device files. Read more about these special files.
- etc the core system configuration directory (pronounced EHT-cee). User password, boot, device, networking, and other setup files are here. Many items in /etc are specific to the particular hardware on the machine — for example, the /etc/X11 directory contains the graphics card configuration.
- home holds personal directories for normal users on the system. Most Unix installations conform to this standard.
- lib An abbreviation for library. In Linux, this directory holds library files containing code that
executables can use. There are two types of libraries: static and shared. The /lib directory should contain only shared libraries, but other lib directories such as /usr/lib contain both varieties, as well as other auxiliary files.
- proc Provides system statistics through a directory-and-file interface that you can browse with standard Unix tools. Much of the /proc subdirectory structure on Linux is unique, but many other Unix variants have similar features.
- sbin The place to find system executables. Programs in sbin directories pertain to system
management, so regular users usually do not have sbin components in their command paths. Many of the utilities don’t work for normal users.
- tmp The place to put smaller temporary files that you don’t care much about. Any user may read to and write from /tmp, but they may not have permission to access another user’s files there. Some programs use this directory as a workspace. If something is extremely important, don’t put it in /tmp. Most distributions clear /tmp when the machine boots, and some even remove its old files periodically. Don’t fill /tmp either, because its space is usually shared with something critical (like the rest of /, for example).
- usr Pronounced as “user,” but this subdirectory does not contain user files (there have been no user files in /usr on Unix systems long before Linux existed). Instead, /usr is a large directory hierarchy that looks a little like the root. The bulk of the Linux system resides in /usr. Many of the directory names in /usr are the same as in the root and hold the same type of files; /usr/bin and /usr/lib are two examples. The primary reason that the root does not contain the complete system is to keep space requirements low.
- var The “variable” subdirectory, where programs record runtime information. System logging, user
tracking, caches, and other files that system programs create and tend all go into /var. There is a /var/tmp similar to /tmp, but the system doesn’t wipe it clean on boot.
Learn about Exploit with OS Command Injection