Understanding UNIX / Linux filesystem Inodes
admin
2023-02-03 23:00:09
0

Theinode (index node)is a fundamental concept in the Linux and UNIX filesystem. Each object in the filesystem is represented by an inode. But what are the objects? Let us try to understand it in simple words. Each and every file under Linux (and UNIX) has following attributes:

=> File type (executable, block special etc)
=> Permissions (read, write etc)
=> Owner
=> Group
=> File Size
=> File access, change and modification time (remember UNIX or Linux never stores file creation time, this is favorite question asked in UNIX/Linux sys admin job interview)
=> File deletion time
=> Number of links (soft/hard)
=> Extended attribute such as append only orno one can delete fileincludingroot user (immutability)
=> Access Control List (ACLs)

All the above information stored in an inode. In short the inode identifies the file and its attributes (as above) . Each inode is identified by a unique inode number within the file system. Inode is also know as index number.

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.

How do I see file inode number?

You can use ls -i command to see inode number of file
$ ls -i /etc/passwd
Sample Output

32820 /etc/passwd

You can also use stat command to find out inode number and its attribute:
$ stat /etc/passwdOutput:

File: `/etc/passwd'
Size: 1988            Blocks: 8          IO Block: 4096   regular file
Device: 341h/833d       Inode: 32820       Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2005-11-10 01:26:01.000000000 +0530
Modify: 2005-10-27 13:26:56.000000000 +0530
Change: 2005-10-27 13:26:56.000000000 +0530

Inode application

Many commands used by system administrators in UNIX / Linux operating systems often give inode numbers to designate a file. Let us see he practical application of inode number. Type the following commands:
$ cd /tmp
$ touch \"la*
$ ls -l

Now try to remove file "la*

You can't, 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 useinode number to removefile. This is fourth part of "UnderstandingUNIX/Linux filesystem, continue reading rest of the Understanding Linux file system series (this is part IV):


相关内容

热门资讯

首次突破 屡创新高!一组数字解... 2026年上半年我国GDP同比增长4.7%经济韧性持续彰显在已经出炉的经济数据中更值得关注的还有“含...
男主播卖惨,66岁患癌老太花光... 今年3月,沈阳66岁的张阿姨在家养病期间刷视频时,被一名IP属地为湖北的男主播吸引。该主播主打演唱经...
松下智能马桶盖不喷水怎么回事 松下智能马桶盖不喷水怎么回事1、有时候新买的马桶在安装的时候工人有时候会不会告诉你需要开进水阀的,智...
松下智能马桶盖不喷水 1、有时候新买的马桶在安装的时候工人有时候会不会告诉你需要开进水阀的,智能马桶都是带有进水阀的,如果...
智能马桶盖不喷水故障维修方法 如果是出水口不喷水,先检查下是不是里面没水,或者水管出问题了,水管故障问题需找专业的维修师傅维修;若...
马桶水箱盖子碎了能换么 不能,建议更换整个水箱。方法:先检查排污管及产品内通道是否有异物;确定固定蹲便的安装位置、高度以及将...
洗衣机e1是什么故障 洗衣机e1是什么故障出现这个代码时,是表示洗衣机的进水时间超长了,洗衣机的进水系统发生了问题,比如,...
阿联酋航空发文致歉 7月23日,阿联酋航空发布致歉信:原计划于7月22日从迪拜飞往上海的阿联酋航空EK302航班,因恶劣...
给“南海仲裁案”递刀子的美国人... 执笔/李小飞刀7月12日晚,菲律宾内格罗斯东方省锡布兰镇的一处公寓内,突然响起一阵枪声,美国海洋生物...
特朗普称沙特加入《亚伯拉罕协议... △美国总统特朗普(资料图)当地时间7月23日,美国总统特朗普在社交媒体“真实社交”上发文表示,美国能...