Name
stat — stdin stdout - file -- opt --help --version
Synopsis
stat [options
]files
The stat
command displays
important attributes of files. By default, file information is printed
in one long line:
➜ stat myfile
234881026 3004666 -rw-r--r-- 1 lisa staff 0 1264 ...
but you can display it in a more friendly manner with the
-x
option:
➜ stat -x myfile
File: "myfile"
Size: 1264 FileType: Regular File
Mode: (0644/-rw-r--r--) Uid: (501/lisa) Gid: (20/staff)
Device: 14,2 Inode: 3004666 Links: 1
Access: Sun Mar 11 20:31:53 2012
Modify: Wed Mar 7 22:05:56 2012
Change: Wed Mar 7 22:05:56 2012
This includes the filename, size in bytes (1,264), file type (Regular File), permissions in octal (0644), permissions in the format of “ls -l” (-rw-r--r--), owner’s user ID (501), owner’s name (lisa), owner’s group ID (20), owner’s group name (staff), device information (14,2), inode number (3004666), number of hard links (1), and timestamps of the file’s most recent access, modification, and status change.
Useful options
| Follow symbolic links and report on the file they point to. |
| Display the results in a friendly, readable format. |
| Display the results in a highly configurable format; see the manpage for details. |
Get Macintosh Terminal Pocket Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.