4

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.

6

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
...
| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.