Site icon TechAIpost

What is the Linux File System? Unix / Linux File System Basics explained

Linux file system explained

A file system is a logical collection of files on a partition or disk. A partition is a container for information and can span an entire hard drive if desired. Your hard drive can have various partitions which usually contain only one file system, such as one file system housing the /file system or another containing the /home file system. One file system per partition allows for the logical maintenance and management of differing file systems. Everything in Unix is considered to be a file, including physical devices such as DVD-ROMs, USB devices, and floppy drives. If you are new to the Linux operating system, then you might not be familiar with the file system. You need to cover this topic if you want to grow as a Linux user.

What is the Linux file system?

Linux File System or any file system generally is a layer which is under the operating system that handles the positioning of your data on the storage, without it; the system cannot knows which file starts from where and ends where. Even if you find any unsupported file system type

A Linux File System is a logical bundle of files on the disk or partition. Partition is a container that stores information and can even span a whole hard drive if it is required. A hard drive can be consist of various partitions which generally consist of only one file system such a file system housing /file system and another naming /home file system.

In one partition, a single file system is allowed for the logical maintenance and management of the different file system. In Unix, everything is considered to be a file, even the physical devices like DVD ROMs, USB, and floppy drives are considered as the file.

The Directory Structure

In Unix, a hierarchical File System structure is used like an upside-down tree which has a root at the base of the file system and all other directories are spread around like the branches. The Unix files and directories have the following properties –

Every directory has a specific purpose and holds the same types of information for the quick file allocation. Below the list of the major Linux directories and their roles have been elaborated.

Navigating the File System

Now, as we have studied the basics of the file system, then the next step is to navigate the files you need from the system. The basic navigation commands that you can use are –

There are plenty of other navigation commands available. To know more about other commands and their syntax you can use the Manage Help option.

The df Command

The first way to manage your partition space is with the df (disk free) command. The command df -k (disk free) displays the disk space usage in kilobytes, as shown below −

$df -k

Filesystem      1K-blocks      Used   Available Use% Mounted on

/dev/vzfs        10485760   7836644     2649116  75% /

/devices                0         0           0   0% /devices

$

Filesystem – The physical file system name
kbytes – Total kilobytes of space available on the storage medium
used – Total kilobytes of space used (by files)
avail – Total kilobytes available for use
capacity – Percentage of total space used by files
Mounted on – What the file system is mounted on

Some directories like /dev only show 0 in the kbytes and almost avail 0% capacity. These are special file systems, they don’t reside on the disk under root and they don’t consume any space over the disk.

The du Command

It is a disk usage command that helps you in specify directories to show the disk usage space on the particular directory. It is a useful command when you want to determine the space taken by particular directory on the disk. In below-mentioned command, several blocks used by each directory have been calculated.

$du /etc

10     /etc/cron.d

126    /etc/default

6      /etc/dfs

$

The -h option makes the output easier to comprehend −

$du -h /etc

5k    /etc/cron.d

63k   /etc/default

3k    /etc/dfs

$

Linux File System is a very deep concept and can’t be fully expressed in one small post. In the file system guide, there are multiple other layers that remain undiscussed like mounting, unmounting and much more. But, the basics of the file system are discussed in the post which is sufficient to start with the Linux operating system.

Exit mobile version