Forrest logo
back to the stat tool

stat:tldr:e6c17

stat: Show the size of the file in bytes.
$ stat -f "%z %N" ${filename}
try on your machine

The command stat -f "%z %N" ${filename} is used to display the size and the name of the specified file.

Here's a breakdown of the different parts of the command:

  • stat: This is a command-line utility that provides information about filesystems and files.
  • -f: This option is used to specify the output format of stat. In this case, %z and %N are used as format specifiers.
  • " %z %N": This is the format string passed to the -f option. It specifies that we want to display the size (%z) and the name (%N) of the file.
  • ${filename}: This is the variable representing the filename that you want to retrieve the size and name for. You would replace ${filename} with the actual filename you wish to inspect.

When you execute this command with a specific filename, it will display the size of the file in bytes followed by the full path and name of the file.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the stat tool