linux下stat程序简介
2013-05-27 23:39
204 查看
1、简介
stat程序可以显示文件或者文件系统的信息。
2、参数
Usage: stat [OPTION] FILE...
Display file or filesystem status.
-f, --filesystem display filesystem status instead of file status
-c --format=FORMAT use the specified FORMAT instead of the default
-L, --dereference follow links
-Z, --context print the security context information if available
-t, --terse print the information in terse form
--help display this help and exit
--version output version information and exit
The valid format sequences for files (without --filesystem):
%A Access rights in human readable form
%a Access rights in octal
%B The size in bytes of each block reported by `%b'
%b Number of blocks allocated (see %B)
%D Device number in hex
%d Device number in decimal
%F File type
%f Raw mode in hex
%G Group name of owner
%g Group ID of owner
%h Number of hard links
%i Inode number
%N Quoted File name with dereference if symbolic link
%n File name
%o IO block size
%s Total size, in bytes
%T Minor device type in hex
%t Major device type in hex
%U User name of owner
%u User ID of owner
%X Time of last access as seconds since Epoch
%x Time of last access
%Y Time of last modification as seconds since Epoch
%y Time of last modification
%Z Time of last change as seconds since Epoch
%z Time of last change
Valid format sequences for file systems:
%a Free blocks available to non-superuser
%b Total data blocks in file system
%c Total file nodes in file system
%d Free file nodes in file system
%f Free blocks in file system
%C - Security context in SELinux
%i File System id in hex
%l Maximum length of filenames
%n File name
%s Optimal transfer block size
%T Type in human readable form
%t Type in hex
3、示例
1)显示指定文件的状态信息
stat /root/.bashrc
File: `/root/.bashrc'
Size: 470 Blocks: 8 IO Block: 4096 regular file
Device: 301h/769d Inode: 2195486 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2013-05-27 23:36:35.000000000 +0800
Modify: 2013-04-06 10:37:03.000000000 +0800
Change: 2013-04-06 10:37:03.000000000 +0800
2)显示文件系统状态信息
stat -f /root/.bashrc
File: "/root/.bashrc"
ID: 0 Namelen: 255 Type: ext2/ext3
Block size: 4096 Fundamental block size: 4096
Blocks: Total: 5077005 Free: 4277190 Available: 4015131
Inodes: Total: 5242880 Free: 5132870
stat程序可以显示文件或者文件系统的信息。
2、参数
Usage: stat [OPTION] FILE...
Display file or filesystem status.
-f, --filesystem display filesystem status instead of file status
-c --format=FORMAT use the specified FORMAT instead of the default
-L, --dereference follow links
-Z, --context print the security context information if available
-t, --terse print the information in terse form
--help display this help and exit
--version output version information and exit
The valid format sequences for files (without --filesystem):
%A Access rights in human readable form
%a Access rights in octal
%B The size in bytes of each block reported by `%b'
%b Number of blocks allocated (see %B)
%D Device number in hex
%d Device number in decimal
%F File type
%f Raw mode in hex
%G Group name of owner
%g Group ID of owner
%h Number of hard links
%i Inode number
%N Quoted File name with dereference if symbolic link
%n File name
%o IO block size
%s Total size, in bytes
%T Minor device type in hex
%t Major device type in hex
%U User name of owner
%u User ID of owner
%X Time of last access as seconds since Epoch
%x Time of last access
%Y Time of last modification as seconds since Epoch
%y Time of last modification
%Z Time of last change as seconds since Epoch
%z Time of last change
Valid format sequences for file systems:
%a Free blocks available to non-superuser
%b Total data blocks in file system
%c Total file nodes in file system
%d Free file nodes in file system
%f Free blocks in file system
%C - Security context in SELinux
%i File System id in hex
%l Maximum length of filenames
%n File name
%s Optimal transfer block size
%T Type in human readable form
%t Type in hex
3、示例
1)显示指定文件的状态信息
stat /root/.bashrc
File: `/root/.bashrc'
Size: 470 Blocks: 8 IO Block: 4096 regular file
Device: 301h/769d Inode: 2195486 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2013-05-27 23:36:35.000000000 +0800
Modify: 2013-04-06 10:37:03.000000000 +0800
Change: 2013-04-06 10:37:03.000000000 +0800
2)显示文件系统状态信息
stat -f /root/.bashrc
File: "/root/.bashrc"
ID: 0 Namelen: 255 Type: ext2/ext3
Block size: 4096 Fundamental block size: 4096
Blocks: Total: 5077005 Free: 4277190 Available: 4015131
Inodes: Total: 5242880 Free: 5132870
相关文章推荐
- jchat:linux聊天程序1:简介
- APUE读书笔记-00预备知识(04)-Linux系统中程序库文件简介
- (转载)Linux 配置文件简介/登录注销,文件系统,系统管理,守护进程,用户程序配置文件/Understanding Linux configuration files
- linux strace程序简介
- linux下修改MAC地址的macchanger程序简介
- MCAPI学习笔记<一>——简介与Linux下示例程序测试
- Linux系统中程序库文件简介
- linux下killall程序简介
- Linux系统中程序库文件简介
- linux unzip程序简介
- linux程序wget简介
- Linux GDB程序调试工具使用简介
- linux下lsof程序简介
- linux上打包程序tar && 压缩程序 && 源代码安装软件 --简介
- linux下的uniq程序简介
- linux程序调试命令addr2line之入门简介(本文先不聊gdb调试)
- Linux 的两种引导程序 LILO 和GRUB 简介
- linux下C语言编程1-gdb调试程序简介
- linux下c程序编译过程及GCC,G++, GDB简介
- Linux引导程序 grub简介