2017-10-16 02:02:25 +01:00
|
|
|
# stat
|
|
|
|
|
|
|
|
> Display file status.
|
2024-01-31 10:20:27 +00:00
|
|
|
> More information: <https://keith.github.io/xcode-man-pages/stat.1.html>.
|
2017-10-16 02:02:25 +01:00
|
|
|
|
|
|
|
- Show file properties such as size, permissions, creation and access dates among others:
|
|
|
|
|
2022-12-04 09:12:49 +00:00
|
|
|
`stat {{path/to/file}}`
|
2017-10-16 02:02:25 +01:00
|
|
|
|
2021-08-15 18:59:09 +01:00
|
|
|
- Same as above but verbose (more similar to Linux's `stat`):
|
2017-10-16 02:02:25 +01:00
|
|
|
|
2022-12-04 09:12:49 +00:00
|
|
|
`stat -x {{path/to/file}}`
|
2017-10-16 02:02:25 +01:00
|
|
|
|
2017-10-16 07:07:39 +01:00
|
|
|
- Show only octal file permissions:
|
2017-10-16 02:02:25 +01:00
|
|
|
|
2022-12-04 09:12:49 +00:00
|
|
|
`stat -f %Mp%Lp {{path/to/file}}`
|
2017-10-16 02:02:25 +01:00
|
|
|
|
2017-10-16 07:07:39 +01:00
|
|
|
- Show owner and group of the file:
|
2017-10-16 02:02:25 +01:00
|
|
|
|
2022-12-04 09:12:49 +00:00
|
|
|
`stat -f "%Su %Sg" {{path/to/file}}`
|
2017-10-16 02:02:25 +01:00
|
|
|
|
2017-10-16 07:07:39 +01:00
|
|
|
- Show the size of the file in bytes:
|
2017-10-16 02:02:25 +01:00
|
|
|
|
2022-12-04 09:12:49 +00:00
|
|
|
`stat -f "%z %N" {{path/to/file}}`
|