Linux Root Directory (Linux)

Root directory layout

Have you ever run the ls command on the root of a Linux system and wonder what all the directories are and what they contain?

The root directory layout of a Linux system can initially seem a little confusing, with directories like /usr being name user but not really being used as a location for users files.

For this blog post I am going to be using a Raspberry Pi 4 and Raspbian (Linux) to take a brief look at the Linux root directory.

Directory Layout

Root directory layout
Root directory layout

When the ls command is run at the root it returns the following directories:

  • bin
  • dev
  • home
  • lost+found
  • mnt
  • proc
  • run
  • srv
  • tmp
  • var
  • boot
  • etc
  • lib
  • media
  • opt
  • root
  • sbin
  • sys
  • usr

The Directories

/bin

geektechstuff_bin_directory
The linux /bin directory

bin is short for binary, and the /bin directory is where executables (e.g. programs) in binary format are stored. When you run ls, cp, grep, chmod etc they are all binaries stored in this directory.

/dev

The linux /dev directory
The linux /dev directory

Contains various device files that the Linux system relies on, including devices Linux installed during the operating system installation.

/home

Contains the user’s home folder, which then contains the user’s deskop, documents etc.

/lost+found

If the fsck command finds any data corruption on a partition it places the corrupted data into the lost+found directory.

/mnt

Can be used to mount additional drives into the current file hierarchy.

/proc

The Linux /proc directory
The Linux /proc directory

Contains information on currently running processes and system resource usage.

/run

geektechstuff_run_directory
The Linux /run directory

Run time data since the systems last boot.

/srv

Server information being served/offered by the computer.

/tmp

Contains temporary files.

/var

geektechstuff_var_directory
The Linux /var directory

Contains cache files and the log directory.

/boot

geektechstuff_boot_directory
The Linux /boot directory

Contains the Linux boot loader files.

/etc

geektechstuff_etc_directory
The Linux /etc directory

Configuration files used by the system or software on the system.

/lib

The Linux /lib directory
The Linux /lib directory

Libraries that are called by files in /bin and /sbin.

/media

Location where removable media (e.g. USB pen drives) connect to.

/opt

I think this was for “optional” software, i.e. 3rd party software.

/root

The root user’s home directory.

/sbin

geektechstuff_sbin_directory
The Linux /sbin directory

System binaries, i.e. the system (s) version of /bin.

/sys

System files containing information about the system, devices and the kernel.

/usr

Does not contain user files. Large parts of the Linux operating system are contained in the /usr section.

Want To Find Out More?

The best way to learn about Linux is to explore it and that can be done by installing Linux in a virtual machine, booting from a Linux USB drive / Live disc, or installing Linux as your operating system (OS).

Wikipedia on Filesystem Hierarchy.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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