Going Easy Mode With Linux
The Big Question
Okay, let me start off with the big question. Is Linux an operating system? Well, yes but no. When people talk about Linux, they refer to the whole operating system which includes the Linux kernel and various GNU tools and utilities, which is technically wrong and creates ambiguity. Just so you don't get confused anymore, remember these two things.
Linux refers to the kernel, the core component of an operating system. The kernel is responsible for managing system resources, interacting with hardware, and providing essential services. Linus Torvalds initially created the Linux kernel in 1991.
GNU (GNU's Not Unix) is a project initiated by Richard Stallman in 1983 to develop a free, open-source Unix-like operating system. The GNU project aimed to provide a complete set of tools and utilities that could be used with the Linux kernel to create a fully functional operating system.
So, in essence, "Linux" is more than just the kernel – it's a combination of the Linux kernel and the GNU software suite working together. To understand everyone's contribution better I recommend this blog by Richard Stallman.
Linux Distributions
Linux distributions or distros are basically whole operating systems built around the Linux Kernel with a diverse array of software components, tools and package managers. You may think, "Why so many distros?" Basically every distro serves a different purpose. Some are more focused towards development, some towards stability and some focus on gaming and performance. The one you'd choose is really a personal preference.
Some of the popular Linux distributions are Ubuntu, Debian, Fedora, Arch Linux, Open SUSE, Manjaro, Cent OS and more. For beginners I'd recommend Fedora or Ubuntu. For desktop themes choose the one you like more. Gnome offers simplicity, while KDE has immense customization options.
Now with those out of the way, we can dive into the main topics. Let's go.
Linux File System
The Linux file system is the structure and organization of files and directories on a Linux-based operating system. It follows a hierarchical tree-like structure, starting from the root directory ("/") and branching out into various sub-directories.
Root("/")
The root directory is the top-level directory in the Linux file system. All other directories and files are organized beneath it. We can navigate to the root directory using the cd /
command. Now if you do a ls
here, you will see multiple sub-directories. Let us go through each sub directory one by one.
bin
The bin directory contains binaries or executables that are required for the whole OS. You can find all the binaries by running the ls
command. This directory contains binaries for programs like the cd & ls commands we just ran. We can run these binaries from the command line using their name.
boot
This contains the files required to boot the system, for example the Linux kernel.
dev
In this directory you can find hardware of your system that you can interact with like normal files. Here, you can manage your storage, create partitions etc.
etc
This directory contains the editable text configs for your system. If you want to modify the behavior of the system, you can edit these files to achieve that.
home
The home directory contains user data. It has folders named after each user of the system and this named folder is visible to their corresponding logged in user. Inside that folder there are files, configs and executables for that user. You can go to the home directory using cd /~
command.
lib
The binaries we discussed have some common code between them. This is stored in the lib Directory.
lost+found
This directory contains the broken files after a system crash.
media
This is the mount point for removable media. When you plug in a new media it will show up here.
mnt
This is where temporary mounted devices show up.
opt
This directory contains optional or add-on software that you may install.
proc
This is a pseudo file system that is created by the Linux kernel to keep track of running processes.
root
This is the home directory for the root user. No user can access it without the root password.
run
This directory stores information of the system since boot like logged in users, running daemons, etc.
sbin
Now this directory system binaries that can be executed by only the root user. Like mount, deluser, etc.
srv
This directory is occasionally used for files served by web servers.
sys
This directory contains information about devices, drivers and kernels running on your system.
tmp
As the name suggests it contains temporary files that get deleted upon system reboot.
usr
The usr
directory contains most of the programs and utilities of the system. This directory has its own bin
and sbin
directories that contain binaries that are not essential for the operating system. There is also a local
directory that has its own bin
which contains locally compiled binaries. Fun fact: "usr" stands for Unix System Resources, not user.
var
Variable files are stored here like the log, crash, tmp, etc. These will change as you use your operating system.
The $PATH Environment Variable
$PATH
is an environment variable that specifies a list of directories separated by colon where the system looks for executable files. When you type a command in the terminal, the system searches for the corresponding executable file in these directories in the order specified by the $PATH
variable. If the command is not found in any of these directories, it will give us an error message. You can add new directories to your PATH by editing the .bashrc
located in your home directory.
NOTE:- Editing your .bashrc can be dangerous if you don't know what you are doing. Be careful while doing it.
This is it for this one. In the next blog we will dive deep into the Linux command Line and useful Linux commands everyone should know. See you in the next one.
Subscribe to my newsletter
Read articles from Ansuman Satapathy directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Ansuman Satapathy
Ansuman Satapathy
Sharing my DevOps journey with the world.