Find out the files and folders based on the ownership in Linux / Unix

Find out the files and folders based on the ownership in Linux / Unix :

Every files and folders on Linux/Unix system is owned by a specific user and group .  Using find command in Linux / Unix , we can  list out the files and folders based on the ownership .

dd command to create large size file in linux
Syntax :

To find out the files and folders owned by a user

find <location> -user <username>

To find out the files and folders owned by a group

find <location> -group <groupname>

Examples :  Few examples to find out the files and folders based on the ownership

$ find /home/raj -user sekar

In this above example , find out the files and folders that owned by the user sekar in the /home/raj location .

$ find /tmp -group sshusers

In this above example , find out the files and folders that belongs to the group named sshusers in the /tmp location .

$ find /home -user raj -group sshusers

In this above example , find out the files and folders that belongs to the combination of user raj and group named sshusers

 




Leave a Reply

Your email address will not be published. Required fields are marked *