Powered by Blogger.

How to list all files owned by a user in Linux?

The question is – how to find all files that are owned by a user specified by the username? The username should be a valid username on the Linux machine.

You can use the find command to do this with just one argument: -user
The following command will list all files owned by the user ewhathow:
find . -user ewhathow -ls
This command will list all files owned by ewhathow in the current directory and all its sub-directories. The -ls option shows output in the ls command format which includes several important fields of the file including last modified, owner, group, permissions and more.
If you want to find out files that are owned by specific groups, use the -group option.
find . -group ewhathow -ls
This command will list all files that are owned by the group ewhathow and print it in the ls command format. Note that this will do this recursively in the current directory and all its sub-directories.
    Blogger Comment
    Facebook Comment