If you want to master Linux, you need to know how the Linux File System works. Why not start now?
Table of contents |
Introduction |
Linux directories |
Final thoughts |
Resources |
Introduction
When I started using Linux, coming from Windows, I was a bit lost with all the new directories in Linux. Sometimes their names are intuitive (/home, /boot...), but most of the time I didn't understand what they were used for.
Fear not. Today you are going to learn what are each directory for in no time. Let's go!
Linux directories
/
The root directory. This marks the start of the Linux File system and it is the highest level. All the files and directories are stored here.
/bin
Bin contains binary executables (the Linux version of Windows .exe files). These include the commands you use in the terminal (cat, mkdir, ls, cat...). As you may have guessed, the name of this directory comes from BINaries.
/boot
One of the main directories. Here are stored the files used to boot the system successfully. You shouldn't touch this directory.
/dev
This contains files of devices connected to the system. For example, when you connect a USB, but also hard drives.
/etc
As the name says, it is... etcetera. It stores configuration files required by the system. For example, /etc/shadow, /etc/passwd, etc. Again, you shouldn't touch this directory. And if you do, make a copy of the files you modify (I destroyed my Ubuntu virtual machine messing around with this. Luckily I had a snapshot saved...)
/home
Here you will find the private directory of each user. It contains user directories such as /Downloads, /Documents, /Desktop, etc. The exception is root, which has its own directory.
/lib
It contains libraries of different applications. The package manager controls and manages this directory automatically. These are essential files that you shouldn't mess around with.
/media
Contains (temporal) directories of removable media (for example, when you connect a USB, you can find it at /media//.
/mnt
This is the /media directory of the past. Here the CD ROM readers were mounted, but no longer is used.
/opt
Here are stored the software packages provided by a third party, not installed with the package manager (generally, apt-get). Each application has its own directory inside /opt, containing the files needed to run.
/proc
Contains information about running processes and your computer: CPU, RAM, kernel, etc. The files here are generated at your computer start-up and deleted when powered off.
/root
The home directory of the root account. Despite being a kind of "user directory", it has a different structure than the average user.
/run
One of the newest directories. It contains temporal files that use the RAM memory. Once the computer is powered off, the files disappear.
/sbin
Similar to the /bin directory, but for the root user. It contains special binaries and command line tools used by root. For example, the reboot file that only the admin user can use it is stored here.
/sys
Contains information about devices, drivers and kernels. This directory is managed automatically by Linux.
/srv
Contains information about services, specific to your Linux distribution. This directory is managed automatically by Linux.
/tmp
Contains temporal files, created by running applications, the system or users. Once your computer is powered off, these files are deleted.
/usr
This directory contains libraries, binaries and documentation of the installed programs, that are shared between all the users.
/var
Standing for variable, /var directory contains files that are constantly changing, such as log files, events or spool files.
Final thoughts
Understanding and remembering all the directories in Linux it will take your time. Don't try to memorise it as if you were studying for it: Just by using Linux as you should (using the terminal!) you will get used to it. When you always start in /home/, you will learn that all the users have their own directory there. When you connect a USB to your computer, you will find it at /media, and you will remember that that's the purpose of that folder.
Just keep using Linux and you'll get the hang of it in no time :)
Or you can do one of the Linux courses I'm doing right now.
https://letslearnabout.net/hacking/from-zero-to-hero/networking-and-linux-courses/
Resources
Linux courses
Original post: The Linux File System: A simple guide for beginners
Top comments (0)