Geek

Linux Lexicon: Linux Directory Structure In Detail | fossBytes


Now that you would have installed a Linux Distribution of your liking, you would observe that a lot of things are different in the Linux environment as compared to your previous Windows or Mac one. So, let’s talk more about these differences, starting with the directory structure.

(If you are yet to board the Linux Express, do give the first article of Linux Lexicon series a read)

For starters, the graphical layout would have changed completely, you wouldn’t find any Drive Letters ( like C:/, D:/, E:/ etc. ) and oh, if you are from the Windows background and using a Linux Distribution like Ubuntu, you will find that the restore, minimize and close buttons would have shifted to the opposite side of the screen (something that had me like, uhh.. ). All of this takes a while getting adjusted to, but you shall be alright once you get the hang of it.

Out of the many things that may bewilder you, one is the Linux Directory Structure. It is quite different as compared to the Windows/Mac one. The directories would seem to be particularly mind boggling. But, it is quite important to know about the Linux Directory Structure.


Why, you ask? It is so because a sound knowledge of the Linux directory structure will help you to search for components in the system, figure out where a program resides and answer questions like where do the configuration files or the log files for a particular application exist.

Here is an overview of the Linux Directory Structure along with the details of some of the common top level directories that you must be aware of:

/ – The Root Directory


Denoted by the / (forward slash), the Root Directory is the starting point of the file system hierarchy. Everything in the system, including the other directories and files of the system, are stored in the root directory.

/bin


The /bin directory contains the binaries and other executable programs. Most of the common Linux commands that you may utilize as a user of the system are stored here. Similar to the /bin directory is the /sbin directory, which contains the essential system administration binaries.

/boot


The /boot directory contains the static boot loader files needed to boot the operating system. It contains the GRUB boot loader files along with the Linux kernels.

/dev


The /dev directory contains device files which are typically under the control of the operating system and the system administrators. The terminal devices, disk drives, USB’s etc. are all included in the /dev directory and are exposed as files in Linux, instead of being represented as devices.

/etc


The /etc directory contains the system configuration files. All files in the /etc directory should be text files and cannot be executable binary files. It contains the /etc/passwd and the /etc/shadow files which contain essential user identification and authentication data.

/home


The /home directory contains a home directory for each user. Each user’s personal files and user-specific configuration files are stored in their respective home directories. Each user has write access only to their own home directory. One can not modify the files in the home directory of the other user unless they have acquired the permissions to do so.

/lib


The /lib directory contains the essential system libraries and kernel modules which would be required by the binaries located under the /bin or /sbin directories. Similarly, the /lib64 directory contains libraries required for 64-bit support in systems.

/media


The /media directory is used to temporary mount removable media like external hard disks, CD-ROM’s etc. Once you attach a removable media to a system, a subdirectory will automatically be created inside the /media directory. You shall be able to access the contents of the device from that subdirectory.

/opt


The /opt directory contains sub-directories for optional or third-party software. Most proprietary software keep their files here in the /opt directory.

/proc


The /proc directory contains information about the processes running on your system in directories named /proc/PID where PID is the process id. It also contains information about system resources.

/tmp


The /tmp directory is used by the system and its applications to store their temporary files. All these files are typically cleared on system reboot.

/usr


The /usr directory is used to contain the applications and file pertaining to a particular user as compared to the files and applications of the system. For example, the essential binaries and essential system administration binaries are stored in the /bin & /sbin directories while the non-essential ones are stored in /usr/bin & /usr/sbin directories respectively.

/var


The /var directory is an important part of the Linux Directory Structure & contains variable system files whose data that may grow over time. Log files, packages and database files can be found in the /var directory.

Got any doubts, queries of your own, or any suggestions on the topics that you would like us to cover? Drop them in the comments below.

Grab The Linux Power User Bundle From Our Store

To Top

Pin It on Pinterest

Share This