tldr/pages.zh/osx/stat.md

25 lines
498 B
Markdown
Raw Normal View History

2019-03-15 03:45:10 +00:00
# stat
> 显示文件状态。
> 更多信息:<https://keith.github.io/xcode-man-pages/stat.1.html>.
2019-03-15 03:45:10 +00:00
- 显示文件属性,如大小、权限、创建和访问日期等:
2019-03-15 03:45:10 +00:00
`stat {{文件}}`
- 与上面相同,但更详细(更类似于 Linux 的 `stat`
2019-03-15 03:45:10 +00:00
`stat -x {{文件}}`
- 只显示文件权限:
2019-03-15 03:45:10 +00:00
`stat -f %Mp%Lp {{文件}}`
- 显示文件的所有者和所属组:
2019-03-15 03:45:10 +00:00
`stat -f "%Su %Sg" {{文件}}`
- 以字节为单位显示文件的大小:
2019-03-15 03:45:10 +00:00
`stat -f "%z %N" {{文件}}`