Breaking

Sunday, June 21, 2020

This post is about the file structure or directory structure of the Linux operating system. The file structure is nothing but how an individual computer organizes its data and store it. Linux file structure is somehow different than the Windows and Macintosh operating systems.

When you install Windows OS, it directly gives you the C drive, D drive and you keep your data inside it. But you never know where the system files, configuration files, program files, device files, etc are store. Being open-source, Linux operating system keeps everything in a completely different way to show its file structure. 



Linux operating system represents every device like hard drives, keyboard,  display, etc., everything as a file or a folder. You just need to mount the device in an empty folder, so that you can access the device. 

The “official” rules of a root filesystem are contained in the Filesystem Hierarchy Standard (FHS) that u can get from here.
we are going to discuss some important files rather than all the directories.

So let's understand the file system hierarchy of Linux:-

/:- This is the default and only mount point for all file and folder. Inside this, you can get all the system and user data.
  
/bin/:- It contains the basic binary files, which a user can use to run as Linux commands. Example:- bash, cat, chmod, cp, date, echo, grep, kill, ls, mkdir, mv, mount, more, ping, pwd, rm, sh, uname, umount, etc.

/boot/:- It contains the boot loader file i.e grub or grub2.  Linux kernel and other files required for the boot process. It is similar to the system reserved partition for Windows OS. 

/dev/:- It contains all the device files for the drive, keyboard, mouse, etc. Here you can find the file for your device. like:- vda, vdb, etc.

/etc/:- This is an important folder that contains configuration files for the system. Sometimes you want to change some configuration of your network or system, you can found the file here and can change the configuration parameter of the respective file. It contains files like:- fstab, hostname, hosts, init, init.d, networks, passwd, profile, resolve.conf, services, shell, timezone, etc.

/home/:- user’s personal files like- Documents, Downloads, Music, Video, etc.

/lib/:- It contains the basic library files used by the system. Like DLL (Dynamic Link Library) in windows.



/media/:-Its a default mount point for removable media devices (CD-ROM, USB keys, and so on). If you plug in a USB drive to your Linux system, it will automatically show on your desktop.

/mnt/:- temporary mount point that can be used by root or user having access to it.

/opt/:- It contains data of external applications provided by third parties. like Chrome, Skype, etc.

/root/:- It contains the administrator’s (root’s) personal files.

/proc/:- All files in this folder contains information about the active/running processes.

/sbin/:- It contains the system binaries that can only access by root.

/srv/:- All the service-related data are found here like- the services are started after boot and data used by servers hosted on this system.

/tmp/:- temporary files to store data (this directory is often cleaned at boot)

/usr/:- applications (this directory is further subdivided into bin, sbin, lib according to the same logic as in the root directory)

/var/:- variable data of any Services. like every service has its own data and configuration. For configuration, the default folder is /etc/ and similarly /var/ is for data.


This is the basic file structure and structure information about the Linux operating system that we should know before using it.
close