Friday, April 26, 2013

Advanced use of sed command in Linux                              mpstat command to check cpu usage

Inode in file system is a fundamental concept of unix file system and each object in the file system represented by an inode. Inodes store information about files and directories like ownership, access mode, file type etc. Each file is having unique inode. When we copy file from one location to other that time new inode number assigned to the new file.

If you want to see the inode number of file then use following command:

root@hello:~/hello/shellscript# ls -i

5644164 is the inode of file.
We will copy this file in other location and check the inode for same file:

root@hello:~/hello/shellscript# mkdir test
root@hello:~/hello/shellscript# cp test/
root@hello:~/hello/shellscript# cd test
root@hello:~/hello/shellscript/test#ls -i

You can see same file is having different Inode5770669. i.e. Each file is having unique inode.

Inode stores following information
  • File Size
  • File Type
  • File modification time
  • File Change time
  • File Access time
  • File deletion time
  • Permission
  • Owner
  • Group

Inode contains above information about file.

There is another way to check the inode of a file by stat command.

root@hello:~/hello/shellscript/test# stat
  File: `'
  Size: 446             Blocks: 8          IO Block: 4096   regular file
Device: 801h/2049d      Inode: 5770669     Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2013-04-24 21:30:46.473060619 +0530
Modify: 2013-04-24 21:30:46.493059771 +0530
Change: 2013-04-24 21:30:46.493059771 +0530

Stat command provides the detailed statistics of file. Access Permissions, type of file, IO Block, Size, Device information etc information provided by stat command. Inode is most important concept in Unix operating system.

Inode do not contain file name but it stores metadata of a file.
Posted by Machindra Dharmadhikari On 4/26/2013 10:01:00 AM No comments


Post a Comment

  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube

    Chitika Ads 2



    Enter your email address:

    Delivered by FeedBurner