snippetbashTip
stat — Display file and filesystem information. See also: `file`. More information: <https://www.gnu.org/so
Viewed 0 times
commandstatandclifileinformationfilesystemdisplay
Problem
How to use the
stat command: Display file and filesystem information. See also: file. More information: <https://www.gnu.org/software/coreutils/manual/html_node/stat-invocation.html>.Solution
stat — Display file and filesystem information. See also: file. More information: <https://www.gnu.org/software/coreutils/manual/html_node/stat-invocation.html>.Display properties about a specific file such as size, permissions, creation date, and access date among others:
stat {{path/to/file}}Display properties about a specific file, only showing the raw result data without labels:
stat {{[-t|--terse]}} {{path/to/file}}Display information about the filesystem where a specific file is located:
stat {{[-f|--file-system]}} {{path/to/file}}Show only octal file permissions:
stat {{[-c|--format]}} "%a %n" {{path/to/file}}Show the owner and group of a specific file:
stat {{[-c|--format]}} "%U %G" {{path/to/file}}Show the size of a specific file in bytes:
stat {{[-c|--format]}} "%s %n" {{path/to/file}}Code Snippets
Display properties about a specific file such as size, permissions, creation date, and access date among others
stat {{path/to/file}}Display properties about a specific file, only showing the raw result data without labels
stat {{[-t|--terse]}} {{path/to/file}}Display information about the filesystem where a specific file is located
stat {{[-f|--file-system]}} {{path/to/file}}Show only octal file permissions
stat {{[-c|--format]}} "%a %n" {{path/to/file}}Show the owner and group of a specific file
stat {{[-c|--format]}} "%U %G" {{path/to/file}}Context
tldr-pages: common/stat
Revisions (0)
No revisions yet.