Now that we’ve had a short introduction about UNIX/Linux System, it’s time to discuss about one of the most important components that are part of this OS, the File System. From the beginning you’ll need to know that everything is Linux is treated as a file. That being mentioned, Linux file system is a collection of files and directories grouped together to form one big tree. In many situations you can compare Linux with Windows but, there are some notable things that you’ll need to remember:
- Everything is Linux is a file (drivers, hardware devices, configs, files, etc.) and you can edit them using a file editor like Vi or Vim. Unlike Windows, there are multiple file types used in UNIX/Linux systems as follows:
directories – the same usage as in Windows, containers for grouping multiple files
files – same type as in Windows (text files, photos, executables, etc.)
device files – all drivers in Linux are seen as files and they can be opened and edited using a text editor. Each file has a special number (known as major number) that informs the kernel what driver is used for a particular hardware device.
named pipe and sockets – files that provide inter-communication between processes running in Linux
– is a special type of file that contains a reference to another file or directory in the form of an absolute or relative path and that affects pathname resolution (Wikipedia)
There are other file types that exist in Linux but, these are the most common. If you think that there are others that need mentioned here, please leave a comment and a short description of their role and functionality.
- In Windows you have one tree for each partition (for example C:\), in Linux there is one root for the whole file system. Even if you have multiple partitions created on the disk, all of them will have the same root point.
- Files and folders names are case-sensitive (Unlike Windows, you can have a file named Data and another one dAta). The same principles are applied to all commands, options and arguments used in Linux. Most files do not have an extension and you can use special characters on any position
- The path separator used in Linux is /
If you type ls in the root directory of any Linux system, you’ll see multiple directories, each one with it’s own functionality and you’ll need to know their role in the Operating System. I’ll try to explain directories that needs mentioned:
/home – contains the personal directories of each user, it’s similar with Documents and Settings from Windows
/root – the personal directory of the root user ( the Administrator of the whole system). This user has full access to all resources
/dev – because everything is Linux is treated as a file, even system drivers are presented as files. In this folder you can find all driver files for each hardware component (CPU, Hard-Disk, etc)
/etc – this is similar to registry from Windows, is a directory that contains the settings for system and applications.
/tmp – temporary files are stored in this location. All users can write in this location but data is lost upon reboot
/opt – this directory is used to store third party software. Here, you will install all software that is not shipped with Linux
/boot – contains the necessary files to boot the system (boot loader, kernel and boot manger)
/proc – all files presented here contain information about the running system (info from kernel, CPU, memory, etc.). You can modify kernel’s parameters within this section.
/var – location where variable data is stored (logs, email , print spool, running processes)
/bin – binary files used to run the system
/sbin – contains commands that are used by System Administrators to troubleshoot performance issues.
/lib – contains files that are used to boot the system and run commands from /bin and /sbin (somehow like DLL files in Windows)
/mnt – directory used to mount different file systems
/usr – this directory is intended to store applications for registered users. You can view this folder as Program Files in Windows.
That’s about it for this article folks, please share your thoughts about this one. Note that you’ll need to get a general overview of the whole file system before proceeding any further so please take some time and read this short article. If you think there are other things that I should point out in this article, don’t hesitate to leave a comment and I will respond as soon as possible.
Wish you all the best and stay tuned for the following articles!