You can Watch all our Tutorials and Training Videos for Free on ourYouTube Channel

Linux Directory Structure / File system Hierarchy Explained

linux directory structure, linux filesystem hierarchy, linux directory stucuture explained, linux file system hierarchy explained, linux structure

Linux Directory Structure File system Hierarchy

This post will help you to understand about Linux Directory Structure / File system Hierarchy.

If you are interested in learning, Request you to go through the below recommended tutorial.

Linux Directory Structure / File system Hierarchy

Everything in Linux is either a file or a process.

A file is a collection of data. They are created by users using text editors, running compilers etc.

Examples of files:

  1. a document

  2. the text of a program written in some high-level programming language

  3. instructions comprehensible directly to the machine and incomprehensible to a casual user, for example, a collection of binary digits (an executable or binary file);

  4. a directory, containing information about its contents, which may be a mixture of other directories (subdirectories) and ordinary files.

A process is an executing program identified by a unique PID (process identifier).

File system directory structure in linux

All the files are grouped together in the directory structure. The file-system is arranged in a hierarchical structure, like an inverted tree. The top of the hierarchy is traditionally called root (written as a slash /)

Directory Names
Purpose of the directories
/The root directory, the top-level directory in the FHS. All other directories are subdirectories of root, which is always mounted on some partition. All directories that are not mounted on a separate partition are included in the root directory's partition.
/binEssential command line utilities. Should not be mounted separately; otherwise, it could be difficult to get to these utilities when using a rescue disk.
/bootIncludes Linux startup files, including the Linux kernel. Can be small; 16MB is usually adequate for a typical modular kernel. If you use multiple kernels, such as for testing a kernel upgrade, increase the size of this partition accordingly.
/etcMost basic configuration files.
/devHardware and software device drivers for everything from floppy drives to terminals. Do not mount this directory on a separate partition.
/homeHome directories for almost every user.
/libProgram libraries for the kernel and various command line utilities. Do not mount this directory on a separate partition.
/mntThe mount point for removable media, including floppy drives, CD-ROMs, and Zip disks.
/optApplications such as WordPerfect or StarOffice.
/procCurrently running kernel-related processes, including device assignments such as IRQ ports, I/O addresses, and DMA channels.
/rootThe home directory of the root user.
/sbinSystem administration commands. Don't mount this directory separately.
/tmpTemporary files. By default, Red Hat Linux deletes all files in this directory periodically.
/usrSmall programs accessible to all users. Includes many system administration commands & utilities.
/varVariable data, including log files and printer spools.

If there is a file called mydata.txt under /home/user1/, then the full path of the file is "/home/user1/mydata.txt".

Types of Files Used by Linux

When working with Linux, you need to be aware of the fact that there are a number of different file types used by the file system. This is another area where the Linux file system differs significantly from the Windows file system. With a Windows file system you basically have two entry types in the file system:

  • Directories

  • Files

Granted, you can have normal files, hidden files, shortcut files, word processing files, executable files, and so on. However, these are all simple variations of the basic file when working with Windows.
With Linux, however, there are a variety of different file types used by the file system. These include the file types shown in Table.

File TypeDescription
Regular filesThese files are similar to those used by the file systems of other operating systems—for example, executable files, files, images, text configuration files, etc.
LinksThese files are pointers that point to other files in the file system.
FIFOsFIFO stands for First In First Out. These are special files used to move data from one running process on the system to another. A FIFO file is basically a queue where the first chunk of data added to the queue is the first chunk of data removed from the queue. Data can only move in one direction through a FIFO.
SocketsSockets are similar to FIFOs in that they are used to transfer information between sockets. With a socket, however, data can move bi-directionally.

Hope this post helped you to understand about Linux Directory Structure / File system Hierarchy.

Keep practicing and have fun. Leave your comments if any.

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.
whatsapp logo