Forrest logo
back to the stat tool

stat:tldr:33aad

stat: Show the owner and group of a specific file.
$ stat --format="%U %G" ${filename}
try on your machine

The command "stat --format="%U %G" ${filename}" gives information about the ownership of the specified file.

Here is a breakdown of the command:

  • "stat": It is a command-line utility used to display detailed information about a file or file system.
  • "--format="%U %G"": This option is used to specify the format of the output. In this case, "%U %G" is the format string used. "%U" represents the username of the file owner, and "%G" represents the group name of the file owner.
  • "${filename}": This is a placeholder for the actual filename you want to get ownership information about. You should replace "${filename}" with the path to the file you want to retrieve the ownership details for.

Overall, running this command will display the username and group name of the file owner for the specified 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