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.
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
...