DEV Community

Cover image for Linux File System Explained
Bek Brace
Bek Brace

Posted on

Linux File System Explained

The Linux file system: a labyrinth of directories defined by the file system hierarchy standard,
navigate through it with the change directory command forward slash drops you into the root, then with the command we can list out
the contents of this directory.

First you have the bin directory which contains binaries or executables that are essential to the
entire operating system, you can run these binaries from the command line at any time things like (gzip, curl, and even the ls command),
but confusingly there's also an [ s-bin ] directory which contains system binaries
that should only be executed by the root
user like (mount or delete user), many of these
binaries may share common libraries which are stored in the lib directory.

We also have a (usr) user directory with its own bin and s-bin directories; the binaries or applications here are non-essential to the operating system itself and intended for the end user.

You'll also notice a local directory
under user, this contains any binaries that you
compile manually to provide a safe place that won't conflict with any software installed by a system package manager.

All these binaries get mapped together with the path environment variable and that's why you can execute them from any directory in the terminal if you ever want to know where a binary lives.

At some point you may want to customize the behavior of the software on your system
the [etc] directory which stands for Et Cetera and this is a Latin phrase: Et means β€œand.” Cetera means β€œthe rest.”
In other words the etc directory means simply editable text configuration.

Many of the files in etc end in conf and they're typically just text-based config files that you can modify in your editor (I prefer VIM) as an operating system.
Linux can support multiple users in the home directory you'll find a folder named after each user registered on the system, it contains the files configuration and software for that user
and you need to be logged in as that user or as a root user to modify it ..

Let's go back to the root: there are a few more directories here like:

boot: it contains the files needed
to boot the system like the linux kernel itself

dev which stands for device files: here you can interface with hardware or drivers as if they were regular files, you might create disk partitions here or interface with your floppy drive

the op directory contains optional or
add-on software and you'll rarely interact with it

var contains variable files that will change
as the operating system is being used
things like logs and cache files

temp is for temporary files
that won't be persisted between reboots

and finally we have the weirdest one of

the proc directory is an illusionary
file system that doesn't actually exist
on the disk but is created in memory on the fly by
the Linux kernel to keep track of running processes.

Discussion (0)