linux stat命令参数及用法详解
功能说明:显示inode内容。
语 法:stat [文件或目录]
补充说明:stat以文字的格式来显示inode的内容。
ls 命令及其许多参数提供了一些非常有用的文件信息。另一个不太为人所熟知的命令 stat 提供了一些更为有用的信息。
下面演示了如何对可执行文件“oracle”(位于 $ORACLE_HOME/bin 目录下)使用此命令。
# cd $ORACLE_HOME/bin
# stat oracle
File: `oracle'
Size: 93300148 Blocks:182424 IO Block:4096 Regular File
Device: 343h/835d Inode: 12009652 Links: 1
Access: (6751/-rwsr-s--x) Uid:( 500/ oracle) Gid:( 500/ dba)
Access: 2006-08-04 04:30:52.000000000 -0400
Modify: 2005-11-02 11:49:47.000000000 -0500
Change: 2005-11-02 11:55:24.000000000 -0500
注意使用该命令获得的信息:除了通常的文件大小(也可以使用 ls -l 命令获得)以外,您还获得了该文件占用的块数。通常的 Linux 块大小为 512 字节,因此一个大小为 93,300,148 字节的文件将占用 (93300148/512=) 182226.85 个块。由于块都是完整占用,因此该文件使用了一些整数个数的块。无需猜测就可以获得确切的块数。
您还可以从以上输出中获得文件所有权的 GID 和 UID,以及权限的八进制表示形式 (6751)。如果要将文件恢复到它现在具有的相同权限,可以使用 chmod 6751 oracle,而不是显式拼写这些权限。
以上输出最有用的部分是文件访问时间戳信息。该输出显示,该文件被访问的时间是 2006-08-04 04:30:52(显示在“Access:”的旁边),即 2006 年 8 月 4 日上午 4:30:52。这是某个人开始使用数据库的时间。该文件的date.html' target='_blank'>修改时间是 2005-11-02 11:49:47(显示在“Modify:”的旁边)。最后,“Change:”旁边的时间戳显示文件状态更改的时间。
stat 命令的修改符 -f 显示了有关文件系统(而非文件)的信息:
# stat -f oracle
File: "oracle"
ID: 0 Namelen:255 Type:ext2/ext3
Blocks: Total: 24033242 Free: 15419301 Available: 14198462 Size: 4096
Inodes: Total: 12222464 Free: 12093976
另一个选项 -t 显示了完全相同的信息,只不过是在一行中显示的:
# stat -t oracle
oracle 93300148 182424 8de9 500 500 343 12009652 1 0 0 1154682061
1130950187 1130950524 4096
Everything in Unix is treated as files. This includes devices, directories and sockets — all of these are files. Stat command displays file or filesystem status as explained in this article.
File Stat – Display Information About File
For example, to find out more information about 101hacks.txt file, execute the stat command as shown below.
$ stat 101hacks.txt
File: `/home/sathiyamoorthy/101hacks.txt'
Size: 854 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 1058122 Links: 1
Access: (0600/-rw-------) Uid: ( 1000/ sathiya) Gid: ( 1000/ sathiya)
Access: 2009-06-28 19:29:57.000000000 +0530
Modify: 2009-06-28 19:29:57.000000000 +0530
Change: 2009-06-28 19:29:57.000000000 +0530
Details of Linux Stat Command Output
- File: `/home/sathiyamoorthy/101hacks.txt’ – Absolute path name of the file.
- Size: 854 – File size in bytes.
- Blocks: 8 – Total number of blocks used by this file.
- IO Block: 4096 – IO block size for this file.
- regular file – Indicates the file type. This indicates that this is a regular file. Following are available file types.
- regular file. ( ex: all normal files ).
- directory. ( ex: directories ).
- socket. ( ex: sockets ).
- symbolic link. ( ex: symbolic links. )
- block special file ( ex: hard disk ).
- character special file. ( ex: terminal device file ).
- Device: 801h/2049d – Device number in hex and device number in decimal
- Inode: 1058122 – Inode number is a unique number for each file which is used for the internal maintenance by the file system.
- Links: 1 – Number of links to the file
- Access: (0600/-rw——-): Access specifier displayed in both octal and character format. Let us see explanation about both the format.
- Uid: ( 1000/ sathiya) – File owner’s user id and user name are displayed.
- Gid: ( 1000/ sathiya) – File owner’s group id and group name are displayed.
- Access: 2009-06-28 19:29:57.000000000 +0530 – Last access time of the file.
- Modify: 2009-06-28 19:29:57.000000000 +0530 – Last modification time of the file.
- Change: 2009-06-28 19:29:57.000000000 +0530 – Last change time of the inode data of that file.
Dir Stat – Display Information About Directory
You can use the same command to display the information about a directory as shown below.
$ stat /home/ramesh
File: `/home/ramesh'
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 803h/2051d Inode: 5521409 Links: 7
Access: (0755/drwxr-xr-x) Uid: ( 401/ramesh) Gid: ( 401/ramesh)
Access: 2009-01-01 12:17:42.000000000 -0800
Modify: 2009-01-01 12:07:33.000000000 -0800
Change: 2009-01-09 12:07:33.000000000 -0800
Details of File Permission:
File Permission In Octal Format
This information about the file is displayed in the Access field when you execute stat command. Following are the values for read, write and execute permission in Unix.
linux stat命令参数及用法详解的更多相关文章
- linux mount命令参数及用法详解
linux mount命令参数及用法详解 非原创,主要来自 http://www.360doc.com/content/13/0608/14/12600778_291501907.shtml. htt ...
- 【转】linux expr命令参数及用法详解
在抓包过程中,查看某个设定时间内,数据上下行多少,用命令expr 计算! --------------------------------------------------------------- ...
- linux dmesg命令参数及用法详解(linux显示开机信息命令)
linux dmesg命令参数及用法详解(linux显示开机信息命令) http://blog.csdn.net/zhongyhc/article/details/8909905 功能说明:显示开机信 ...
- linux sed命令参数及用法详解
linux sed命令参数及用法详解 http://blog.csdn.net/namecyf/article/details/7336308 1. Sed简介 sed 是一种在线编辑器,它一次处理一 ...
- linux dd命令参数及用法详解---用指定大小的块拷贝一个文件(也可整盘备份)
linux dd命令参数及用法详解---用指定大小的块拷贝一个文件 日期:2010-06-14 点击:3830 来源: 未知 分享至: linux dd命令使用详解 dd 的主要 ...
- (转)linux expr命令参数及用法详解
linux expr命令参数及用法详解 原文:http://blog.csdn.net/tianmohust/article/details/7628694 expr用法 expr命令一般用于整数值, ...
- (转)linux traceroute命令参数及用法详解--linux跟踪路由命令
linux traceroute命令参数及用法详解--linux跟踪路由命令 原文:http://blog.csdn.net/liyuan_669/article/details/25362505 通 ...
- Linux fdisk命令参数及用法详解---Linux磁盘分区管理命令fdisk
fdisk 命令 linux磁盘分区管理 用途:观察硬盘之实体使用情形与分割硬盘用. 使用方法: 一.在 console 上输入 fdisk -l /dev/sda ,观察硬盘之实体使用情形. 二.在 ...
- linux scp命令参数及用法详解--linux远程复制拷贝命令使用实例【转】
转自:http://blog.csdn.net/jiangkai_nju/article/details/7338177 一般情况,本地网络跟远程网络进行数据交抱,或者数据迁移,常用的有三种方法,一是 ...
- Linux set命令参数及用法详解
linux set 命令 功能说明:设置shell. 语 法:set [+-abCdefhHklmnpPtuvx] 补充说明:用set 命令可以设置各种shell选项或者列 出shell变量.单个选 ...
随机推荐
- Git详解之Git分支
Git 分支 几乎每一种版本控制系统都以某种形式支持分支.使用分支意味着你可以从开发主线上分离开来,然后在不影响主线的同时继续工作.在很多版本控制系统中,这是个昂贵的过程,常常需要创建一个源代码目录的 ...
- SpringBoot 跨域 Access-Control-Allow-Origin 问题
https://blog.csdn.net/taoism_jerry/article/details/79695336 **************************************** ...
- TextView
wrap_content 设置TextView的宽度和高度为 wrap_content,则其大小会自动适应文本. textSize 设置字体大小 textColor 设置字体颜色 <TextVi ...
- JAVA-JSP内置对象之request对象的其他方法
相关资料:<21天学通Java Web开发> request对象的其他方法1.request对象除了可以用来获得请求参数,还可以用来获得HTTP标头及其他信息. 方法 ...
- 网络构建入门技术(1)——IP概述
说明(2017-5-10 11:02:31): 0. IP地址的作用,TCP/IP,网络层,包,源IP(哪个设备发出).目的IP(数据要发到哪个设备),每个设备需要唯一的一个IP地址.32个0到32个 ...
- libXext.so.6: cannot open shared object file:
在64位的centos安装64位的oracle的时候,有时候会出现“libXext.so.6: cannot open shared object file:”的错误. 这个原因主要是oracle在安 ...
- java基础篇---正则表达式
正则表达式在许多语言,例如Perl.PHP.Python.JavaScript和JScript,都支持用正则表达式处理文本,一些文本编辑器用正则表达式实现高级“搜索-替换”功能. 正则表达式是一种可以 ...
- MySQL日志——二进制日志
Mac怎么这么坑呢,搞了2小时了.唉 先来一个简单的,挖好坑,明天解决. 终端进入mysql: mysql> set global general_log=on; 然后进行数据库的任意操作: 查 ...
- 【Unity笔记】寻路导航Navigation中的区域Areas与消耗Cost
Navigation寻路导航界面下,Areas分页下是在给导航区域分类(相当于分层),以及为每个分类设置不同的消费Cost,意义在于,导航算法中会计算出的是累加起来消耗最低的路径(不一定是视觉上最短可 ...
- 【Unity】AssetBundle的使用——打包/解包
最近参考了各位大神的资源,初步学习了Unity的资源管理模式,包括在编辑器管理(使用AssetDatabase)和在运行时管理(使用Resources和AssetBundle).在此简单总结运行时用A ...