Linux - 查看文件信息的三個命令
阿新 • • 發佈:2017-12-02
-i put 詳細 and linu lib class uil 示例
簡明顯示文件的狀態信息:
ls命令 - list directory contents
顯示文件詳細信息:ls -l <file name>
file命令 — determine file type
determine file type :file <file name>
output MIME type strings (--mime-type and --mime-encoding) :file -i <file name>
stat命令 - display file or file system status
顯示文件狀態信息:stat <file name>
顯示文件在系統的狀態信息:stat -f <file name>
簡明顯示文件的狀態信息:
stat -t <file name>
示例:查看“/usr/bin/bash”文件
[anliven@CentOS7 ~]$ ls -l /usr/bin/bash
-rwxr-xr-x. 1 root root 960392 Aug 3 2016 /usr/bin/bash
[anliven@CentOS7 ~]$
[anliven@CentOS7 ~]$ file /usr/bin/bash
/usr/bin/bash: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=b3078871b93598006980c166e4cd885b60a4f6af, stripped
[anliven@CentOS7 ~]$
[anliven@CentOS7 ~]$ file -i /usr/bin/bash
/usr/bin/bash: application/x-executable; charset=binary
[anliven@CentOS7 ~]$
[anliven@CentOS7 ~]$ stat /usr/bin/bash
File: ‘/usr/bin/bash’
Size: 960392 Blocks: 1880 IO Block: 4096 regular file
Device : fd00h/64768d Inode: 5446 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2017-12-01 23:00:01.150409830 +0800
Modify: 2016-08-03 00:00:07.000000000 +0800
Change: 2017-04-23 08:08:44.204147902 +0800
Birth: -
[anliven@CentOS7 ~]$
[anliven@CentOS7 ~]$ stat -f /usr/bin/bash
File: "/usr/bin/bash"
ID: fd0000000000 Namelen: 255 Type: xfs
Block size: 4096 Fundamental block size: 4096
Blocks: Total: 9330226 Free: 8128895 Available: 8128895
Inodes: Total: 18669568 Free: 18540126
[anliven@CentOS7 ~]$
[anliven@CentOS7 ~]$ stat -t /usr/bin/bash
/usr/bin/bash 960392 1880 81ed 0 0 fd00 5446 1 0 0 1512140401 1470153607 1492906124 0 4096
[anliven@CentOS7 ~]$
Linux - 查看文件信息的三個命令