Thursday, June 30

inode (index node)

The inode (index node) is a fundamental concept in the Linux and UNIX file system. Each object in the file system is represented by an inode.

What is Inode?

Definition:
An inode is a data structure on a traditional Unix-style file system such as UFS or ext3. An inode stores basic information about a regular file, directory, or other file system object.
In a file system, a file is represented by an inode. Inodes are data structures that contain information about files that are created when a file system is created. Each file has an inode and is identified by an inode number in the file system where it resides.
The following information are stored in inode.
Owner and group owner of the file.
• File type
• Permissions on the file.
Date and time of creation, last read and change.
• Date and time this information has been changed in the inode.
• Number of links to this file
• File size
• An address defining the actual location of the file data.
Only information that is not stored in inode is its file name and data.

How do I see file inode number?

You can display the inode number associated with a file, use "ls" command along with " -i" option
inode 

Inode application:

If we have files in our system without name or with special characters then we can use inode to remove those files.
rm cannot be used to remove files having blank name or name with special characters.
For Ex:
Below image shows result of ls –lrti. You can see file without name, but with inode number as 2562.
We can use below command to remove this file:
This way we can remove unwanted files from our system and can save disk space.
To remove files having created with control characters or characters which are unable to be input on a keyboard or special character such as ?, * ^ etc. You have to use indoe number to remove file.

1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete