博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux file System inode
阅读量:4030 次
发布时间:2019-05-24

本文共 2312 字,大约阅读时间需要 7 分钟。

The inode (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 or  including 
=> 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 fileDevice: 341h/833d       Inode: 32820       Links: 1Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)Access: 2005-11-10 01:26:01.000000000 +0530Modify: 2005-10-27 13:26:56.000000000 +0530Change: 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 use  file. This is fourth part of “Understanding  system, continue reading rest of the Understanding Linux file system series (this is part IV):

转载地址:http://krhbi.baihongyu.com/

你可能感兴趣的文章
文本处理——词向量
查看>>
编码器—解码器(seq2seq)+ Attention
查看>>
深度学习在搜索广告查询词关键字匹配中的应用
查看>>
关于智能运维(AIOps)的学与思
查看>>
关于问答系统(Q&A)、对话系统(Chatbot)的学与思
查看>>
关于信息检索(IR)、搜索引擎的学与思
查看>>
关于广告、推荐中的CTR的学于思
查看>>
文本分类
查看>>
自然语言处理中的Attention机制
查看>>
pbc 的使用
查看>>
luasocket 安装遇到的问题
查看>>
lua读写redis的环境部署
查看>>
Using MIT-Scheme in MacOS X on the Command Line
查看>>
php redis 接口说明
查看>>
cocos2dx使用lua和protobuf
查看>>
lua5.2 可能会遇到的一些错误
查看>>
C语言编译过程
查看>>
stirling formula prove
查看>>
关于数字类型转化为整型的方法
查看>>
PHP 常用正则表达式整理
查看>>