Forrest logo
back to the stat tool

stat:tldr:d652b

stat: Show owner and group of the file.
$ stat -f "%Su %Sg" ${filename}
try on your machine

The command "stat -f "%Su %Sg" ${filename}" is used to retrieve the owner user and group of a specific file.

Here is the breakdown of the command:

  • "stat" is a command-line utility in Unix-like operating systems that is used to display file or file system status.
  • "-f" is an option that specifies the output format of the stat command.
  • "%Su %Sg" is the output format specified with the -f option. "%Su" represents the owner user, and "%Sg" represents the owner group.
  • "${filename}" is the variable that represents the name of the file for which you want to retrieve the owner user and group.

When you run this command with the desired filename, it will display the owner user and group 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