Understand system directories on Linux systems

Share this post to your friends !

This entry is part 6 of 6 in the series Linux commands: Part 3 - Exploring the system
Understand system directories on Linux systems
5 (100%) 1 vote[s]

WriteBash - This article will help you understand system directories on Linux systems. This, personally, is very important and especially for those who want to become a system administrator.

There will be times when you install a software on a Linux server and you get an error. What should I do now? You will begin to view configuration files to see if anything is wrong.

But to see where those files are, if you don’t understand Linux’s system directory structure, you’ll have trouble.

List system directories on Linux systems

Now, below, I will give you a list of system directories on Linux.

understand-system-directories-on-linux-systems Understand system directories on Linux systems
Understand system directories on Linux systems.

Main directories

/This is the root directory, where all directories or files start on the Linux system. When you understand it’s the root directory, you’ll know why the rm -rf /* command is dangerous and made fun of people who just learned Linux.
/binAbbreviation for the word binaries. that must be present for the system to boot and run.
/bootContains the Linux kernel, initial RAM disk image (for drivers needed at boot time), and the boot loader. In some jobs, you may be able to edit the file /boot/grub/grub.conf or /boot/grub/grub.cfg (depending on base OS), which are used to configure the boot loader.
/devThis directory contains information about all device nodes. On Linux, all devices connected to the system are viewed as files and when you work on files, they are also working on the device. You can see the best example with the command fdisk -l. It will list all drives on the machine, you will see some lines like /dev/sda, /dev/sdb, …
/etc/etc is referred to as the etcetera directory. The /etc directory contains all of the system-wide configuration files. It also contains a collection of shell scripts which start each of the system services at boot time. Most of the software you install on the system, there are configuration files located in this directory. Therefore, when an error occurs, search for the configuration file in this first. Some files you will often work in this directory:

  • /etc/crontab : where you set up automatic scheduling processes for the system. Or you can use the crontab -e command to set.
  • /etc/fstab : where you set up mount points for storage devices on your system.
  • /etc/passwd : a list of the user accounts.
/libAbbreviated for library. The directory contains the shared library files used for the core system. It is similar to DLLs in Windows.

Home and media directories

/homeThis is the home directory of regular users on the system. When you create a new user on the system, it will create a corresponding directory in /home and that user can only write and execute the file on their home directory. For example, I have a user named danie, the home directory is /home/danie, respectively. I can only create, edit, delete and execute files/folders on the /home/danie folder.
/lost+foundEach partition or storage device when connected to your system will have this folder. This folder is used to recover a piece of data if there is a problem corrupt file system. However, most of the time, this directory will be empty.
/mediaOn modern Linux systems, the folder contains mount points for removable devices such as USB, CD-ROM, …
/mntOn older Linux systems, /mnt used to store mount points for removable devices.

System information and options

/optThis directory is used to install optional software. Later, when you install some software such as Zimbra, Mod Security, … then you will see these software will be in the /opt directory.
/procThis is a special folder. It contains files but not really file systems. These files are generated by the kernel and are maintained in the kernel itself. These virtual files display information about your system, which shows the kernel how to identify your system. For example, you want to know how many processors the system has. You type the following command to try it cat /proc/cpuinfo | grep processor.
/rootThis is the home directory for the root account.
/sbinThis directory contains the system binaries files used to perform general system tasks, most of which serve superusers.
/tmpThe directory contains temporary files of programs on the system. This folder can be emptied every time the system reboots.

Unix system resources and logs

/usrSome people say /usr means user, others say /usr means Unix System Resources. You can read more at the FreeBSD documentation about these directories, but I personally think that /usr is more suitable for Unix System Resources. This directory contains all the programs and support files used by regular users.
/usr/binThis directory contains the executable programs installed by Linux distribution. If your read the post about script file location, you will see that I mentioned this folder and what the system will do with the files in this directory.
/usr/libIt contains all shared libraries for the programs in /usr/bin.
/usr/localThis directory does not contain the default operating system programs, but it contains programs compiled from the source and placed in the directory /user/local/bin. Most of these programs are installed and used by users throughout the system.
/usr/sbinContains system administration programs.
/usr/shareThis directory contains all the shared data used by programs in /usr/bin. It’s may include something like example configuration files, document files, …
/usr/share/docWhen you install the software, these software packages will include the documentation that comes with it. Of course, you can read it on the homepage. But these packages will by default place their respective documents in this directory.
/varThis directory is the location of the changed data of the system or the user. For example: PID files, various databases, user mail, …
/var/logThis directory contains system log files, program log files. If you want to troubleshot certain problems, see log in this directory.


Okey, so you have a fairly general overview of the system directory tree structure in Linux systems. Now, practice and learn more about it.

Continue reading the series«« Previous part: Understand long format of ls command in Linux
If you liked this article, then please subscribe to our YouTube Channel for more video tutorials. You can also find us on Twitter and Facebook.

Share this post to your friends !
If you appreciate what we share in this blog, you can support us by:
  1. Stay connected to: Facebook | Twitter | Google Plus | YouTube
  2. Subscribe email to recieve new posts from us: Sign up now.
  3. Start your own blog with SSD VPS - Free Let's Encrypt SSL ($2.5/month).
  4. Become a Supporter - Make a contribution via PayPal.
  5. Support us by purchasing Ribbon Lite Child theme being using on this website.

We are thankful for your support.

single post bottom banner
«« »»

Got something to say? Join the discussion

Please keep in mind that all comments are subject to our Comment Policy. Your email address will not be published.
This site uses Akismet to reduce spam. Learn how your comment data is processed.