Startertutorials Blog
Tutorials and articles related to programming, computer science, technology and others.
Subscribe to Startertutorials.com's YouTube channel for different tutorial and lecture videos.

Categories: Unix Programming. No Comments on Inodes in Unix file system

In this article we will look at Inodes in Unix file system and the commands for displaying and modifying the content of the Inodes in Unix.

 

A file has several components like: name, contents, and administrative information such as permissions and modification times. This administrative information is stored in the inode, along with other essential system data such as how long it is, where on the disc the contents of the file are stored, and so on.

 

There are three kinds of times available in the inode: the time that the contents of the file were last modified (written); the time that the file was last used (read or executed); and the time that the inode itself was last changed (when permissions are changed). These times are as shown below:

 

inodes in unix file system

 

The ls -l command displays last modified time. The ls -lu command displays the last access or usage time and ls -lc command displays the time when the inode was changed for that file. We can test change in last modified time by editing the file. We can test last access time by displaying the file using cat command, test change in inode by using chmod command as shown below:

 

last access time in unix

 

The ls -t command sorts the files based on last modification time of the file. The system’s internal name for a file is its i-number (the number of the inode holding the file’s information). The command ls -i prints the i-number for each file in the current directory as shown below:

 

inode number in unix

 

We can use rm command for deleting a file. The rm command does not actually remove inodes. It removes directory entries or links. The inode is removed only when all the links to the file are removed.

 

We can create a link (alias) to a file when two persons want to share the same file. The command format is ln filename linkname. The i-number for the original file and alias will be same as shown below:

 

Creating links in Unix

 

To maintain a copy of a file, we can use the cp command. This command creates a new file with different i-number from that of the original file. Similarly we use the mv command to move or rename the file.

 

For more information. you can visit the following links:

How useful was this post?

Click on a star to rate it!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Suryateja Pericherla

Suryateja Pericherla, at present is a Research Scholar (full-time Ph.D.) in the Dept. of Computer Science & Systems Engineering at Andhra University, Visakhapatnam. Previously worked as an Associate Professor in the Dept. of CSE at Vishnu Institute of Technology, India.

He has 11+ years of teaching experience and is an individual researcher whose research interests are Cloud Computing, Internet of Things, Computer Security, Network Security and Blockchain.

He is a member of professional societies like IEEE, ACM, CSI and ISCA. He published several research papers which are indexed by SCIE, WoS, Scopus, Springer and others.

Leave a Reply

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