2017-10-15 22:02:25 -03:00
|
|
|
# stat
|
|
|
|
|
|
|
|
> Display file status.
|
2021-11-15 03:45:59 +08:00
|
|
|
> More information: <https://ss64.com/osx/stat.html>.
|
2017-10-15 22:02:25 -03:00
|
|
|
|
|
|
|
- Show file properties such as size, permissions, creation and access dates among others:
|
|
|
|
|
2022-12-04 10:12:49 +01:00
|
|
|
`stat {{path/to/file}}`
|
2017-10-15 22:02:25 -03:00
|
|
|
|
2021-08-15 19:59:09 +02:00
|
|
|
- Same as above but verbose (more similar to Linux's `stat`):
|
2017-10-15 22:02:25 -03:00
|
|
|
|
2022-12-04 10:12:49 +01:00
|
|
|
`stat -x {{path/to/file}}`
|
2017-10-15 22:02:25 -03:00
|
|
|
|
2017-10-16 11:37:39 +05:30
|
|
|
- Show only octal file permissions:
|
2017-10-15 22:02:25 -03:00
|
|
|
|
2022-12-04 10:12:49 +01:00
|
|
|
`stat -f %Mp%Lp {{path/to/file}}`
|
2017-10-15 22:02:25 -03:00
|
|
|
|
2017-10-16 11:37:39 +05:30
|
|
|
- Show owner and group of the file:
|
2017-10-15 22:02:25 -03:00
|
|
|
|
2022-12-04 10:12:49 +01:00
|
|
|
`stat -f "%Su %Sg" {{path/to/file}}`
|
2017-10-15 22:02:25 -03:00
|
|
|
|
2017-10-16 11:37:39 +05:30
|
|
|
- Show the size of the file in bytes:
|
2017-10-15 22:02:25 -03:00
|
|
|
|
2022-12-04 10:12:49 +01:00
|
|
|
`stat -f "%z %N" {{path/to/file}}`
|