Forrest logo
back to the stat tool

stat:tldr:d6c40

stat: Show only octal file permissions.
$ stat -f %Mp%Lp ${filename}
try on your machine

The command stat -f %Mp%Lp ${filename} is used to retrieve the file permissions of a specified file or directory.

Here's a breakdown of the command:

  • stat: This command is used to display file or file system status.

  • -f: This option is used to format the output of the stat command. Instead of displaying all the available information, this option allows you to specify the desired format.

  • %Mp: This is a format specifier, where %M represents the file permissions and p represents the file type.

  • %Lp: This is another format specifier, where %L represents the link count of the file and p represents the file type.

  • ${filename}: This is the placeholder for the filename or directory you want to check the permissions for. You need to replace ${filename} with the actual filename or directory path.

When you run this command, it will display the file permissions (including the file type) and link count for the specified file or directory.

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