GNU/Linux administration – 2 – Linux filesystem hierarchy

 

IMAGE3

Linux is a multitasking operating system which has a very different file-system unlike other Unix-like operating system. As a future Linux System administrator, one has to know what is directory, what is inside each of directories such as /bin, /boot, /etc/, /sbin, /var and so on. In this Linux article you gonna find out the Linux file-system hierarchy and the contents of each of it’s folder.

 

LinuxFS2019

This is how a Linux file-system look like. Now, I’m going to explain each of the directories within the Linux file-system hierarchy starting from the (/) root directory. The article it self is going to be slightly longer but I will try to explain it to you as much as I can. Please comment down bellow for any error you see in the figure it self or in my text.

 

The /

The root is the top level directory on an UNIX-like operating system, which contains all other directories and their sub-directories. It is designated by (/) forward slash. As in the case with all other first directories in the root directories. There is a difference between (/) and the root directory. The root directory is the home directory of the root account. While root account is also known as a root user, user with admin privileges in the entire system. You can view the content of the root by typing the command.

 

 

The /bin

This directory contains the shells like bash, csh as well as commonly used commands such as cp, mv, rm, cat, ls, dd, date and others. You can navigate to this directory by typing cd /bin command in terminal.

The /sbin

The /sbin is similar to the /bin directory. It contains essential binaries that are generally intended to be run by the system administrator.

The /etc

/etc is arguably the most important directory on your system. The /etc directory contains all the configuration and settings files for your server applications. Some of the configuration files inside the /etc directory is: /etc/default/grub which contains GRUB boot loader configuration file. Than there is /etc/fstab file which contains all the mounted devices on your system and we can also mention /etc/apache2.conf which is Apache server configuration file.

The /dev

It contains device files for every single device such as dvd, dvdrw, hdd drives, fd and etc. Among other things you should see /dev/sda which is first SCSI device as well as bunch of other things.

The /proc

/proc is virtual filesystem used by the kernel to communicate with userland tools. It gives you everything you need to know about your running system such as details on the CPU (/proc/cpuinfo), memory usage (/proc/meminfo), and much more. Since it is virtual filesystem, that means that isn’t actually stored anywhere, so it doesn’t take up any disk space.

The /var

/var (short for variables) is traditionally where data is created during the running of a machine would go. All the application and system logs are saved within this directory. Distribution using systemd will have a file /var/log/syslog which contains all global system activity data, including startup messages. Within this directory you can also find /dmesg messages which also outputs startup messages of your system. In general, it is this directory that we can use when some application or system processes goes bad.

The /tmp

This directory is used for the creation of temporary files. Anything can be created here, and most applications that need temporary information stored will put that data in /tmp. /tmp isn’t emptied automatically, although many sysadmin do wipe /tmp every time the system is rebooted.

/usr

This directory contains the vast majority of user software and is often the largest directory on a machine. Although, it’s good to know where your software actually resides, because the default path includes /usr/bin (and /usr/sbin for root), most software “just works” wherever you are located on the system.

/home

User’s home directory which contains personal files, pictures videos, documents, programs and etc. Note that in partition scheme, /home is the largest partition.

/boot

This directory contains everything required for the boot process. On Linux Peppermint it contains the kernel images required to boot. Inside /boot directory there are others subdirectories such as /boot/grub which contains GRUB2 configuration file including boot up images.

/lib

/lib contains system libraries. There’s rarely anything that needs changing in here, and most changes are made through installing software packages. Sometimes it becomes necessary to manually create some symlinks in here, but this practice is generally something that should be avoided if possible.

/opt

/opt is most often used for large third-party applications. It’s not uncommon to find /opt empty on some systems and jam-packed on others. In my case, it contain Numix icon theme folder.

/mnt

This is a generic mount point under which you mount your filesystem or device. The purpose of this directory has changed.

/media

This directory contains subdirectories which are used as mount points for removable media such as floppy disks, cdroms and other devices.

/srv

The service data or /srv directory contains “data for services provided by the system”. For example, if you are using Apache HTTP server to serve your website, you’d likely store your website files inside this directory.

 

References

  • Matotek, Dennis – Turnbull, James – Lieverdink, Peter (2017)

Pro Linux System administration

Apress Media, LLC – California, p119

About Amar Tufo

My name is Amar Tufo. I'm 27-years old. Currently I'm hold bachelor degree of archaeology. Experienced Linux user and blogger, writer and future Linux system administrator.
This entry was posted in Linux administration, Uncategorized and tagged , . Bookmark the permalink.

2 Responses to GNU/Linux administration – 2 – Linux filesystem hierarchy

  1. WOW just what I was searching for. Came here by searching
    for intestinal blockage

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.