HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

stat — Display file status. More information: <https://keith.github.io/xcode-man-pages/stat.1.html>.

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandstatstatusclifileinformationmoredisplay
macos

Problem

How to use the stat command: Display file status. More information: <https://keith.github.io/xcode-man-pages/stat.1.html>.

Solution

stat — Display file status. More information: <https://keith.github.io/xcode-man-pages/stat.1.html>.

Show file properties such as size, permissions, creation date, and access date among others:
stat {{path/to/file}}


Same as above but verbose (more similar to Linux's stat):
stat -x {{path/to/file}}


Show only octal file permissions:
stat -f %Mp%Lp {{path/to/file}}


Show owner and group of the file:
stat -f "%Su %Sg" {{path/to/file}}


Show the size of the file in bytes:
stat -f "%z %N" {{path/to/file}}

Code Snippets

Show file properties such as size, permissions, creation date, and access date among others

stat {{path/to/file}}

Same as above but verbose (more similar to Linux's `stat`)

stat -x {{path/to/file}}

Show only octal file permissions

stat -f %Mp%Lp {{path/to/file}}

Show owner and group of the file

stat -f "%Su %Sg" {{path/to/file}}

Show the size of the file in bytes

stat -f "%z %N" {{path/to/file}}

Context

tldr-pages: osx/stat

Revisions (0)

No revisions yet.