Linux Vs Windows File System
Linux file system is a hierarchical tree structure. We have the root folder just like a tree root and inside the root folder we have different folders which has it's own purpose and inside those folders, we have other folders and files.
In comparison the Windows file system does not have one root folder where all folders extend from, rather it has multiple root folders. We have disks or drives as root folders. Earlier in the era of insertable disks like floppy disks or CDs windows used letters to assign drives for each insertable disks. Eg: A and B were removable disks. When HDDs were added to PCs, the letter C became the letter for the internal disk or hard drive and after that all additional disks were given the next available letters and it has stayed the same until now. That's how the file system is different from that of Linux
Linux file system overview
The Graphical User Interface (GUI) always has this graphical file system view. The file-explorer program shows us the folders and files in a graphical representation that we can navigate easily.
Now I am inside the root directory. Inside the root directory, we can see the home directory. This is basically where all Linux users' personal space is created. Each user has their own space in the home directory except for the root user which actually has its own isolated folders separated from all other users. The folder named /root is the home directory of the root user and /home directory is the home directory for all other users.
If you open the home directory you can see the user's home directory
What is a binary?
Binary is a computer-readable format that the computer understands. Instead of a text, it is a combination of 1s and 0s. The executables must be in binary for the computer to understand. This is why all these commands are in the bin folder.
/sbin
sbin are also binaries but system binaries. These commands are system-relevant. These commands need a super user permission to execute them. Examples of these commands are adduser, passed, chpasswd, iptables for network configuration, etc. All these commands need super user privilege which normal users don't have. These commands are mostly used by system administrators to administer the system and also by the system itself.
/usr
usr stands for user. Originally this was used as the user directory before home directory came into the picture. If we look inside the /usr directory we see a bunch of folders. We have /bin,/sbin,/lib folders just like we have in the root directory at user level. The same commands we see in the root folders binary folders can be seen inside the usr directory as well. It is because there is a historical reason. As the UNIX system design had storage limitations in the older days, it was split to root binary folders and user binary folders. The duplication doesn't make sense in modern era of storage solutions. However, the concept remains from the old times. Also whenever we execute common Linux commands they are executed from the user's bin folder.
Note again that the /usr folder is inside the root. So everything that is installed in the local folder will be available for all users on the computer. It is a systemwide installation. For eg: if you install docker in /usr/local every user in the system can access docker. However, in linux it is possible to install applications specific to users' by installing it in the user's home directory
/opt
This is another location where some third-party programs that you install will be placed.
/dev
dev stands for devices. This is the location of device files like keyboard, mouse, hard disk, webcam, etc. Applications regarding the hardware connected to your computer will be placed in this directory
/tmp
We also have a temporary folder where temporary resources required for some processes are kept here temporarily. At some point, they will be deleted usually at system reboots.
/media and /mnt
Media is basically where your external media is mounted. It contains subdirectories, where removable media devices inserted into the computer are mounted.
Example external hard drive, network drive, USB drives, etc. They will also be referenced in the /dev folder.
For manually mounting for eg: file systems to your OS you have this /mnt folder.
Usually we are not interacting with these folders directly. Most of the time these are automatically dealt by the package managers.
But when you are debugging or troubleshooting it is good to know where the files are located. I have used ubuntu 22.04 to demonstrate the file structure.
SOCIAL SHARE CARD GENERATOR