This article will help you understand the Linux Root file structure.
Let’s change directory to /
and ls
. Here you’ll see numerous directories and might be a little confused, don’t worry it’s all self explanatory.
/bin
Unlike Windows Linux keeps all its basic programs aka binaries in the bin directory, such as: ls, cd, touch, mkdir,
.
/boot
This directory is where you would mount your boot partition, if you used a GUI Linux install, then this is done automatically. But on a Gentoo or Arch you would partition the drive and mount the boot partition. Don’t mess with this file or else you might break your system.
/dev
The dev dir is shorthand for devices. This is where all your connected devices like your webcam, keyboard, and mouse live.
/etc
This is one of the most important directories of your entire Linux system, it’s where most system default settings are located. Many applications also put a default config file here.
/home
The home dir is where all the local users and their personal configurations are stored. Most people should already know this one.
/lib and /lib64
Not all Linux distros will have both of these, all they have are binaries for our applications.
/media
Media is where your removable USB drives are automatically mounted.
/mnt
The mnt aka mount directory is where you would manually mount any drive that doesn’t mount automatically in the /media
directory.
/opt
The opt aka optional dir is where you have drivers from vendors, some web browsers will have data here too.
/proc
All the processes you have running are located here. They’re organized by numbers (process ids) instead of names. If you run top
you’ll see the numbers correspond to a process.
/root
The root user’s home directory. You need to be root to access it. It’s used as a fallback in case your home folders messes up for whatever reason.
/run
This is a temporary directory that’s created every time a user logs in. Once the system is shut off it disappears, it’s a cache of certain services: DHCP, system files, printer set up and more.
/sbin
System binaries are kept here, all the tools a system administrator needs to use. For example the mkfs
command which turns a drive into certain files systems is an administrator tool. Obviously you need root privileges to run any of these.
/sys
This is where your kernel lives. Usually, users wouldn’t mess with this folder at all. Even if you’re a Gentoo user and you’re compiling your kernel, you wouldn’t access it from here. It’s also a temporary directory like /run
.
/srv
This folder is used mostly for Linux servers. Any services you would run as a Linux box would be put in here.
/tmp
The temporary directory will store all data on running programs. If you’re editing a file that you haven’t saved, a copy of that file will be saved in here. This way you can easily recover your document if the program crashes.
/usr
This where application binaries are located for the current user. Unlike /bin
/sbin
which are available for ALL users.
/var
This is the variable directory where package manager info and system logs are stored.
Comments