5

How can I search the files based on the owner or group in command line?

Right now I have tried ls -lR, that gives all the details of files in sub directories also, and I needed to manually search the files owned by root.

1 Answer 1

7

You can use the find command:

find /path/to/directory -user root

For example:

$ find /var -user gdm
/var/lib/gdm
/var/lib/gdm/.config
/var/lib/gdm/.config/gnome-session
/var/lib/gdm/.config/gnome-session/saved-session
/var/lib/gdm/.config/ibus
/var/lib/gdm/.config/ibus/bus
/var/lib/gdm/.config/dconf
/var/lib/gdm/.config/dconf/user
...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .