Examining the Linux Filesystem

Shannon Paige
Plaintext Computer Science
3 min readSep 10, 2020

What they don’t want you to know!

Did you know all copies of Linux come with the the same top level directories?

Linux filesystem
Top Level Directories in Ubuntu

Ok, ok, in retrospect that’s pretty obvious, but it wasn’t something I ever really thought of before.

Of course an OS comes with its own set of files. Let’s take a look at what they are and what they’re for.

bin: Short for binaries*. This directory contains the programs you can run out of the box with Linux. If you list the contents of this directory you’ll see stuff like “cp”, “grep”, “ls”, “rm” and a bunch more that I don’t recognize.

boot: This basically contains everything you need to boot a Linux computer. Much like the nightstand next to your parent’s bed, you don’t need to look in there.

dev: Short for device (not development, which is what I originally thought). This directory contains the device files for every hardware device. This is kinda cool — hardware is a file. Whaaa! Yep. These files represent each device on the computer (like a webcam or printer).

etc: This contains the system configuration files for your computer. So stuff like the names of the users, which shell to use, stuff that you probably don’t wanna mess with until you know what you’re doing.

home: This is the home directory for user files. Every user gets their own subdirectory, so for example, I have a subdirectory /home/shannon. Within that subdirectory, my user has its own /bin and /lib.

lib: Short for library. Contains files that stuff in /bin and /sbin need to share to boot the system.

media: This is where removable media devices, such as thumb drives and CDs, show up when you plug them in. (Do thumb drives and CDs still exist?)

mnt: Short for mountpoint. From everything I’ve read, this isn’t really used anymore. But it has something to do with being a temporary spot that can be used while the administrator is repairing or working on a filesystem.

opt: Short for optional. If a third party program has files, they’ll probably be dropped in here.They might also end up in /usr/local

proc: Oh, we’ll spend a lot more time on proc….

root: This is not the root (/) filesystem. It is the home directory for the root user.

sbin: Short for system binary. This is just like /bin except it’s for all the binaries that are important to system administration.

tmp: Short for temporary. Not surprisingly, files that are meant to be temporary get written in this directory.

usr: Short for user. These are shareable, read-only files that are used by a user (get it), as opposed to an application. So if it’s an essential binary, it’ll come out of the box and be in /bin or /sbin, but if it’s just a fun binary you probably install yourself, it’ll be in /opt/bin or /usr/local/bin

var: Short for variable. Full of all the stuff you wish you could put in /usr, but you can’t cause of the read-only-ness. This can include things like log files and database files. It’s like the yin to /usr’s yang, since /usr is read-only, this one is specifically for writing.

There ya go. Now you can look at your top level of Linux and honestly say you have a vague idea about what some of the directories are for.**

*Binaries = files that are written in 0s/1s (binary) and thus are computer readable, as opposed to human readable. Unless you can read binary. and then, why are you here?

**Depending on what type of Linux you’re on, you might have more directories than what’s mentioned here.

--

--

Shannon Paige
Plaintext Computer Science

I’m a software engineer without the vocabulary of a software engineer. I try to explain things to myself. Maybe you’ll like it, too.