Inode is an unique identification number , which uniquely exist for each file in Linux system.An Inode is a data structure that stores the following information about a file –
- Size of file
- Device ID
- User ID of the file
- Group ID of the file
- The file mode information and access privileges for owner, group and others
- File protection flags
- The timestamps for file creation, modification etc
- link counter to determine the number of hard links
- Pointers to the blocks storing file’s contents
The name of file is not stored in Inode.When a file is created inside a directory then the file-name and Inode number are assigned to file. These two entries are associated with every file in a directory.When a user tries to access the file or any information related to the file then he/she uses the file name to do so but internally the file-name is first mapped with its Inode number stored in a table. There is a table (Inode table) where this mapping of Inode numbers with the respective Inodes is provided.Some of the commands used to know Inode number is-
- ls –i , used to see Inode number of each file, at left side Inode number is shown and right side is file name.
- df – i, shows the Inode number of File system,