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 shellscript.sh
5644164 shellscript.sh
root@hello:~/hello/shellscript#
|
5644164 is the inode of shellscript.sh 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 shellscript.sh test/
root@hello:~/hello/shellscript#
cd test
root@hello:~/hello/shellscript/test#ls -i shellscript.sh
5770669 shellscript.sh
root@hello:~/hello/shellscript/test#
|
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 shellscript.sh
File: `shellscript.sh'
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
root@hello:~/hello/shellscript/test#
|
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.
0 comments:
Post a Comment