Javatpoint Logo
Javatpoint Logo

Linux Inodes

An Inode number is a uniquely existing number for all the files in Linux and all Unix type systems.

When a file is created on a system, a file name and Inode number is assigned to it.

Generally, to access a file, a user uses the file name but internally file name is first mapped with respective Inode number stored in a table.

Note: Inode doesn't contain the file name. Reason for this is to maintain hard-links for the files. When all the other information is separated from the file name then only we can have various file names pointing to the same Inode.


Inode Contents

An Inode is a data structure containing metadata about the files.

Following contents are stored in the Inode from a file:

  • User ID of file
  • Group ID of file
  • Device ID
  • File size
  • Date of creation
  • Permission
  • Owner of the file
  • File protection flag
  • Link counter to determine number of hard links

Example:

Linux Inodes1

Look at the above snapshot, it shows some of the Inode contents.


Inode Table

The Inode table contains all the Inodes and is created when file system is created. The df -i command can be used to check how many inodes are free and left unused in the filesystem.

Linux Inodes2

Look at the above snapshot, the command "df -i" shows the usage of several file systems.


Inode Number

Each Inode has a unique number and Inode number can be seen with the help of ls -li command.

Linux Inodes3

Look at the above snapshot, Directory Disk1 has the three files and each file has a different Inode number.

Note: The Inode doesn't contain file content, instead it has a pointer to that data.

Next TopicLinux Directories





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA