Linux File System. All you need to know about.

file system in linux, when searched file types in linux

You know in Linux file is everything. In this tutorial i will explain you one of the most and important pillar which support Linux and UNIX– the File System. Known as Linux file system in general.

The file system in Linux is one of its simple and conceptually clean feature. As you know Linux looks at everything as a file and a Linux system has thousands of files resides in it.

What is a File ?

A container which stores information is known as File. You can treat it simply as a sequence of characters. It can be a document, picture, audio or video stream, data library, program file, application, or other collection of data. 

Very important point here, Linux treats directories and devices as a file. In Linux system a directory is a folder which keeps filenames and other sub-directories. A Linux system considers all physical devices like your hard drive, CD-ROM, printer, memory etc. as files.

Imp: In Linux system a shell is also a file and kernel too.

Linux File Types

In UNIX there are different types of categories are there.

  • Ordinary File or Regular File
  • Directory File
  • Device File
  • Symbolic link file or soft link file
  • FIFO (Named Pipe)
  • Socket

Ordinary File

An ordinary file also known as regular file commonly is the most common file type in Linux system. All programs (C, C+, Java etc.) belongs to this file type.

Ordinary file is divided into two types such as Text File and Binary File.

Text File:: It contains only printable ASCSI character within the range 0-127. Often we can view the content of a text file and can make sense out of it. Here every line ends with a new line character, created by ENTER Key.

For Example: ALl ‘C’, Source Codes, all Python Scripts, Shell Scripts

Binary File:: It contains both printable as well as non-printable characters within the ASCSI range 0-255. We can not make any sense after viewing a binary file because it contains ASCSI symbols.

For Example: All C and Java Object codes, all image, video, audio files are binaries. And also most Linux/UNIX commands are Binary File type.

When displaying the Binary File type with cat command it produces unreadable output and it may also disturb your terminal settings.

Directory File

Very important point you should keep in your mind that some users say and sometimes it is commonly said that a directory contains files and other directories. But it contains their names and inode number of a file or directory.

If you have directory and 10 files in a directory, there will be only 10 entries resides in the directory. It contains 2 attributes of a file.

  • The File name
  • Inode Number( A unique identification number of every newly created file which system assigns)

Unlike windows folders Linux directories never contain file data, file data are stored in data blocks.

Tip: A directory contains filename and not the file’s contents.

Device File

Linux or UNIX considers every hardware devices as a file. They have different types of names also. All these device files are stored in the directory (/dev). A device file is indeed special it’s not really a stream of characters. In fact it does not contain anything at all.

Symbolic link File

Symbolic link file also known as Soft link file. It is a very special type of file which contains path of the original file. Also you can say a symbolic link is a reference to another file.

FIFO (Named Pipe)

One of the main advantage and strength of Linux or Unix it has always been inter-process communication. Among the facilities provided by the OS are pipes, which connect the output of one process to the input of another. This is fine if both processes exist in the same parent process space, started by the same user, but there are circumstances where the communicating processes must use FIFOs, here referred to as named pipes. One such circumstance occurs when the processes must be executed under different user names and permissions.

Named pipes are special files that can exist anywhere in the file system. They can be created with the command mkfifo


A Unix/Linux socket is a special file which allows for advanced inter-process communication. A Unix Socket is used in a client-server application framework. In essence, it is a stream of data, very similar to network stream (and network sockets), but all the transactions are local to the filesystem. Unlike named pipes which allow only unidirectional data flow, sockets are fully duplex-capable.

Door ( Not a Linux File type But a UNIX file type)

A door is a special file for inter-process communication between a client and server, currently implemented only in Solaris. It does not come under Linux file types.

A door is marked with a D (upper case) as the first letter of the mode string.

Parent Child Relationship

All the files in Linux system are related to each other. The collection of all these files (Ordinary, directory, device etc.) is called as file system. And the filesystem in Linux is organized in a hierarchical structure. Directories/Files are here in a parent child relationship.

Linux file system is considered as single monolithic tree, an inverted one, root upwards.

As you can see this tree is organized in hierarchical structure.

See what are the directories and what it contains.

PathType of Data Holds
/binStands for binary. It contains command files of maximum commands
/devIt contains all device files
/etcThis directory contains system configuration.
/homeHome directory contain all users
/libThis directory contains all C language library files
/sbinSuper user bin. This dir contains command files of administrative commands
/stand/unixthis is unix kernel
/boot/vmlinuzPath of Linux kernel path
/tmpIt contains temporary files, system wipes away this files in regular interval
/usr or /usr/binthis directory contains command files of few additional commands
/usr/includeThis dir. contain all C language header files
/varThis is variable part of the file system. Contains all user mailbox, crontab file of all user
/var/logContains system logs

Path of A file

A file path is the human-readable representation of a file or directory location on a computer system. In Linux system the Path of a File is of two types.

  • Absolute Path
  • Relative Path

Absolute Path : This is the path with respect to ‘/’ directory.

For Example: If you are on your dir1 directory and wanted to jump to X1 file, the command for Absolute path will be as below

cd /home/user/dir1/X1

Relative Path : This is the path with respect to current directory. Relative pathing is quite helpful while accessing files and directory down the hierarchy. But while going above the hierarchy or jumping to a different branch we need absolute path.

For example: If you are dir1 and wanted to jump to X1

cd X1


Remember POSIX recommends file types and Linux is POSIX complaint. But Solaris have an extra file type i.e Door which i have mentioned anyways. Other-than that whatever file types are discussed are part of Linux file type. But it does not come under Linux file type. Though i have mentioned major discussion of Linux file types, in this post but i have covered all the file in UNIX and Linux.

2 Comments on “Linux File System. All you need to know about.”

Leave a Reply

Your email address will not be published. Required fields are marked *