stat
The "stat" command line tool is used to display the detailed status or information about a file or file system. It provides various details such as file type, size, access permissions, inode number, and timestamps (last access, modification, and status change) of a file. The "stat" command is available on most Unix-like operating systems, including Linux and macOS. By default, it displays the status of a single file, but can also be used with wildcards or multiple file names to display information about multiple files at once. The output of the "stat" command includes both human-readable information and numeric representations of various fields. It can be used in scripts and programs to retrieve specific details about a file and perform actions based on that information. The "stat" command can also be used with symbolic links to display information about the target file, rather than the link itself. In addition to regular files, it can provide information about directories, symbolic links, sockets, FIFOs (named pipes), and other file types. The output can be customized with command-line options to display specific details or modify the formatting of the output. Overall, the "stat" command is a powerful tool for retrieving detailed information about files and file systems from the command line.
List of commands for stat:
-
stat:tldr:20e0b stat: Display properties about a specific file such as size, permissions, creation and access dates among others without labels.$ stat --terse ${filename}try on your machineexplain this command
-
stat:tldr:253cf stat: Show only octal file permissions.$ stat --format="%a %n" ${filename}try on your machineexplain this command
-
stat:tldr:2a1fd stat: Display properties about a specific file such as size, permissions, creation and access dates among others.$ stat ${filename}try on your machineexplain this command
-
stat:tldr:33aad stat: Show the owner and group of a specific file.$ stat --format="%U %G" ${filename}try on your machineexplain this command
-
stat:tldr:9d320 stat: Same as above but verbose (more similar to Linux's `stat`).$ stat -x ${filename}try on your machineexplain this command
-
stat:tldr:bee1c stat: Display information about the filesystem where a specific file is located.$ stat --file-system ${filename}try on your machineexplain this command
-
stat:tldr:c86f5 stat: Show the size of a specific file in bytes.$ stat --format="%s %n" ${filename}try on your machineexplain this command
-
stat:tldr:d652b stat: Show owner and group of the file.$ stat -f "%Su %Sg" ${filename}try on your machineexplain this command
-
stat:tldr:d6c40 stat: Show only octal file permissions.$ stat -f %Mp%Lp ${filename}try on your machineexplain this command
-
stat:tldr:e6c17 stat: Show the size of the file in bytes.$ stat -f "%z %N" ${filename}try on your machineexplain this command