How to display only Permissions and file names using ls command?

24,744

Solution 1

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.

Solution 2

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.

Solution 3

ls | xargs stat --printf "$(pwd)/%n %U %G %A \n"
Share:
24,744

Related videos on Youtube

Diogo
Author by

Diogo

Updated on September 17, 2022

Comments

  • Diogo
    Diogo 4 months

    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?

  • Leo Simon
    Leo Simon over 6 years
    This seems to me to be the most direct way to accomplish the result