5

How can I display only Permissions and file names using ls command and how to list all files in a directory including full path, owner, group and permissions for each file?

migrated from stackoverflow.com Oct 18 '10 at 13:56

This question came from our site for professional and enthusiast programmers.

10

you can use GNU find command instead of ls unless you are doing homework

find /path -printf "%f: %p: %u: %g %m (%M) \n" 

check the man page of find more the meaning of those specifiers.

5

You should actually do it that way

find /path -printf "%f:%p:%u:%g:%m\n"

That way you get also the permissions and each file gets listed on one line.

2
ls | xargs stat --printf "$(pwd)/%n %U %G %A \n"
  • 1
    This seems to me to be the most direct way to accomplish the result – Leo Simon Jun 27 '16 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy