Linux directory layout hierarchy

karthik · updated · flag

Like I mentioned in the previous lesson, the Linux file hierarchy is simple with just one top level directory called the root. The path is just /. If you have an Ubuntu installation, you can navigate to the File System from the GUI folder icon you see on the left dock. You’d find the following directories.

Path Description
/ Root directory. Think of it like this super huge file cabinet you have at home. The top most directory that holds everything.
/bin Binaries directory. Where OS utility programs exist as compiled binary files as executables.
/boot Boot directory. This is where the kernel lives along with the files that are required at the time of start up (boot).
/dev Devices directory. Here you can find your actual devices exposed to you as files. For now, think of it as a file representation of system devices.
/etc Etcetera. Every application in Linux are configurable. And these configurations are stored in this directory as .conf files.
/home Home directory. As a user, this is your very own directory to store stuff.
/lib Libraries directory. The essential utility binaries from the /bin directories have their dependencies, manuals, and libraries housed in /lib along with languages like Python.
/media Media directory. This directory is used in the hierarchy for all your media devices.
/mount Mount directory. When you mount other filesystems like Windows or temporary filesystems, this directory will be used.
/opt Optional directory. Where any optional software packages will be installed.
/proc Process directory. Just like the /dev directory, this one exposes system processes as files.
/root Home directory for root. Like how you have a home directory for you, this one’s for the root user of the operating system. You’ll learn about the root user in the next lesson.
/run Run directory. During boot times this directory is used by the system to store their temporary files. It’s also used instead of /tmp when file permissions and security are involved.
/sys System directory. All low-level stuff that’s related to system modules like the kernel, device firmware, and other modules.
/tmp Temporary directory. For all the temporary file needs of the rest of the software. It has a relaxed permission unlike /run.
/usr User directory. It holds all the static user system resources that’s used by all the users. Whatever is non-essential (core level) at /bin and /lib stuff, would be found here.
/var Variable directory. As the name suggests, it contains all the directories and files like system logs that usually keep changing frequently.

Keep this as a reference and don’t get bogged down by the intricate design of the hierarchy all at once. Like with any tool, the more you spend time with Linux, the more you will understand it.