linux file System inode
来源:互联网 发布:scala 下载 linux版本 编辑:程序博客网 时间:2024/05/29 05:02
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 no one can delete file including root 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/passwd
Output:
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 inode number to remove file. This is fourth part of “Understanding UNIX/Linux file system, continue reading rest of the Understanding Linux file system series (this is part IV):
- linux file System inode
- EXT2 file system inode.c with my comments
- Linux file system hierarchy
- Linux File System - Basics
- linux file system
- Embedded Linux - File System
- Linux file system superblock
- linux file System directory
- Linux File System浅析
- linux file system
- Linux驱动程序设计——struct inode 和 struct file
- linux文件系统与模型【笔记】 surper block/inode/dentry/file
- Linux 文件系统的 Superblock, Inode, Dentry 和 File
- Linux 文件系统的 Superblock, Inode, Dentry 和 File
- Linux编程基础:文件描述符file descriptor与inode
- linux中 struct file 和 struct inode简介
- Linux驱动程序中的file,inode,file_operations三大结构体
- Linux驱动程序中的file,inode,file_operations三大结构体
- Android使用http协议实现文件的上传
- Ubantu开机黑屏,只有白色光标在左上角闪烁的解决办法
- LeetCode 74 Search a 2D Matrix
- java中:重写与重载
- C# 读取数据库 DateTime 转 string
- linux file System inode
- 微服务架构的优势与不足
- C# 读写文件
- 虾米成长记
- Could not calculate build plan: Plugin org.apache.maven.plugins:maven-war-plugin:2.1.1 or one of its
- C++容器内存分配特点简介
- JNI 使用过程的一些问题处理。
- 七牛https网页上传base64图片出现net::ERR_INSECURE_RESPONSE
- StringBuffer