LINUX

LINUX STAT指令

介紹

stat指令用來顯示檔案(夾)的屬性。

語法

stat [options] files
Code language: plaintext (plaintext)

常用的options

-L Follow symbolic links and report on the file they point to. -f Report on the filesystem containing the file, not the file itself. -t Terse mode: print information on a single line.
Code language: plaintext (plaintext)

範例

你可以顯示檔案(夾)的屬性:

⤍ stat myfile File: myfile Size: 1024 Blocks: 8 IO Block: 4096 regular file Device: 802h/2050d Inode: 12865945 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 1000/ mt) Gid: ( 1000/ eecsmt) Access: 2021-04-27 20:00:00.000000000 +0800 Modify: 2021-04-27 20:00:00.000000000 +0800 Change: 2021-04-27 20:00:00.000000000 +0800 Birth: -
Code language: plaintext (plaintext)

屬性裡包含了檔名(myfile)、位元組大小(1024)、區塊大小(8)、檔案格式(regular file)等等。

使用-f,你可以顯示檔案(夾)所在檔案系統的屬性:

⤍ stat -f myfile File: "myfile" ID: 12ed1aa123c123c1 Namelen: 255 Type: ext2/ext3 Block size: 4096 Fundamental block size: 4096 Blocks: Total: 59453638 Free: 56073366 Available: 53035862 Inodes: Total: 15171584 Free: 14809247
Code language: plaintext (plaintext)

屬性裡包含了檔名(myfile)、檔案系統識別碼(12ed1aa123c123c1)、檔名長度限制(255)、檔案系統格式(ext2/ext3)等等。

發佈留言