So in Linux everything treat as a file this is one of the simplified feature of Linux.
Everything is treated as a file in Linux because of two main reasons:-
Treating everything as file makes it convenient to write programs based on hardware.For example , you may send some command to your mouse with a simple read() function as if you are reading a file(details are complex obviously).
Treating hardware as a file makes in simpler to enforce permissions on hardware similar to a file through the use of umasks.
Understanding file system of Linux is best way to understand how Linux works .
These special files may be located in pseudo or virtual file systems such as /dev, which contains special files that represent devices, and /proc, which contains special files that represent system and process information.
1. / – Root
The root directory is the first or top-most directory in a hierarchy.
The root file system is the file system contained on the same disk partition on which the root directory is located.
It is the filesystem on top of which all other file systems are mounted as the system boots up.
Only root user has write privilege under this directory.
Please note that /root is root user’s home directory, which is not same as /.
2. /bin – User Binaries
It contains essential binary files (unlike
/usr/bin
directory) also for booting.It usually contains the shells like bash and commonly used commands like
cp
,mv
,rm
,cat
,ls
.Unlike
/sbin
, the bin directory contains several useful commands that are of use to both the system administrator as well as non-privileged users.

Bin Directory
3. /boot Boot-loaders
/boot/ directory holds files used in booting the operating system.
The contents are mostly Linux kernel files or boot loader files, depending on the boot loader, most commonly (on Linux) LILO or GRUB.
vmlinuz – the Linux kernel.
initrd.img – a temporary file system, used prior to loading the kernel.
System.map – a symbol lookup table.
4. /dev Device Files
The /dev directory contains the special device files for all the devices. The device files are created during installation.
The majority of devices are either block or character devices,however other types of devices exist and can be created. In general, ‘block devices’ are devices that store or hold data, ‘character devices’ can be thought of as devices that transmit or transfer data.
For example, diskette drives, hard drives and CD-ROM drives are all block devices while serial ports, mice and parallel printer ports are all character devices. There is a naming scheme of sorts but in the vast majority of cases these are completely illogical.

dev Directory
5. /etc Configuration File
This is the nerve center of your system, it contains all system related configuration files in here or in its sub-directories. A “configuration file” is defined as a local file used to control the operation of a program; it must be static and cannot be an executable binary. For this reason.
It’s a good idea to backup this directory regularly. It will definitely save you a lot of re-configuration later if you re-install or lose your current installation. Normally, no binaries should be or are located here.

/etc Directory
6. /lib or lib64 – System Libraries
The lib folder is a library files directory which contains all helpful library files used by the system. In simple terms, these are helpful files which are used by an application or a command or a process for their proper execution. The commands in /bin or /sbin dynamic library files are located just in this directory.
7. /opt – Optional add-on Applications
This directory is reserved for all the software and add-on packages that are not part of the default installation. For example, StarOffice, Kylix, Communicator and WordPerfect packages are normally found here. To comply with the FSSTND, all third party applications should be installed in this directory.
8. /mnt – Mount Directory
Temporary mount directory where sysadmins can mount filesystems.
9. /proc – Process Information
Linux implementation includes a directory for each running process, including kernel processes, in directories named /proc/PID, where PID is the process number. Each directory contains information about one process, including: /proc/PID/cmdline, the command that originally started the process.
/ proc directory
10. /sbin System Bineries
Utilities used for system administration (and other root-only commands) are stored in /sbin
, /usr/sbin
, and /usr/local/sbin
. /sbin
contains binaries essential for booting, restoring, recovering, and/or repairing the system in addition to the binaries in /bin
. Programs executed after /usr
is known to be mounted (when there are no problems) are generally placed into /usr/sbin
. Locally-installed system administration programs should be placed into /usr/local/sbin
.
/sbin is similar to /bin, which contains executable programs needed to boot (i.e., start) the system, except that /sbin’s programs are normally executed only by the root user. Thus, /sbin is by default not in the PATH environmental variable of ordinary users, but it is for the root account.
by the
11. /srv – Service Data
srv. Srv is a serve folder. It holds site specific data to be served by the system for protocols such as, ftp, rsync, www, cvs etc. To be compliant distributions include this folder but I have not seen it used much.
12. /sys
Modern Linux distributions include a /sys
directory as a virtual filesystem (sysfs, comparable to /proc
, which is a procfs), which stores and allows modification of the devices connected to the system, whereas many traditional UNIX and Unix-like operating systems use /sys
as a symbolic link to the kernel source tree.
In essence /sys allows you to get information about the system and its components (mostly attached and installed hardware) in a structured way.
13. /var – Variable Files
The /var Directory. /var is a standard subdirectory of the root directory in Linux and other Unix-like operating systems that contains files to which the system writes data during the course of its operation
This includes — system log files (/var/log); packages and database files (/var/lib); emails (/var/mail); print queues (/var/spool); lock files (/var/lock); temp files needed across reboots (/var/tmp).
14. /usr – User Programs
/usr usually contains by far the largest share of data on a system. Hence, this is one of the most important directories in the system as it contains all the user binaries, their documentation, libraries, header files, etc…. X and its supporting libraries can be found here
User programs like telnet, ftp, etc…. are also placed here. In the original Unix implementations, /usr was where the home directories of the users were placed (that is to say, /usr/someone was then the directory now known as /home/someone).
15. /home – Home Directorty
A home directory is a file system directory on a multi-user operating system containing files for a given user of the system.
you can also make different partition of home partition and you can encrypt your home folder.
16. /temp directory
Temp Directory is used to store temporary files buy operating system like updates some program installers files .
temp folder is auto cleaned up during boot process of operating system.
I hope this article is helpful to many new Linux users follow us for new latest tech updates Linux tutorials how to ,and more tech stuff.
if you guys have any confusion please comment down bellow
thanks for the coming 🙂