Home > Software engineering >  Get CHMOD Value and Owner name - Unix
Get CHMOD Value and Owner name - Unix

Time:10-08

Their is any command to get CHMOD value and Owner name of a directory on Unix

expected output: PATH/OF/DIR 777 ADMIN

CodePudding user response:

stat -c "%n %a %U" -- *

Change the wildcard to a specific directory as you wish/need.

From man stat:

-c  --format=FORMAT
          use the specified FORMAT instead of the default; output a newline after each use of FORMAT

%a     access rights in octal (note '#' and '0' printf flags)
%n     file name
%U     user name of owner
  • Related