Linux: Main file system locations

dirs
Ed Phillis
Ed Phillis

A file system is a logical collection of files on a partition or disk. In the above image you can see the names of the main directories that stem from the root directory on a linux operating system. The '.' denotes the current directory and '..' denotes the parent directory. i.e 'ls .' will list the files and directories in the current directory and 'ls ..' will list the files and directories in the parent directory of the directory where the command is being run.

 

/ is the root directory from which all other directories stem.

/var is where log files are located along with other dynamic content such as websites.

/etc is where configuration files are stored.

/usr the name is a misnomer as it looks like it contains user files. It was orginally designed for that purpose but now it generally contains /bin, /sbin and /lib directories and the root equivalents just point to there appropriate versions in the /usr. (TBC)

/bin contains binaries and other applications that you may use as a non-sudo user such as ls or echo.

/sbin is like bin but the s relates to superuser and contains applications that only the superuser might need. If you try and run an application from sbin, such as iptables or swapon, as a non-sudo user you will get 'permission denied'.

/lib is where libraries are located.

/home is where user home directories are located and contain files related to the user such as .bash_profile and ssh login key pair credentials.

/opt is often used for third party software that doesnt come included by default with the linux distribution. e.g Atlassian Jira.

/dev pseudo file system that contains the device/hardware files.

/sys

/boot This directory contains files required for starting your system.

/tmp contains temporary files.