Fun With Find

Find command combined with exec can give you about anything you want. For example, you want to list and output to file for user “darkwan”.

find / -user darkwan -exec ls -ld {} \; > /tmp/output

Cool! How about change the owner of files, from “darkwan” to “root” ?

find / -user darkwan -exec chown root {} \;

Anyway, be warned about the destructive of the command if you combined it with rm ! 

More about this topic can be referred here.

Advertisement



    Leave a Reply

    Please log in using one of these methods to post your comment:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Connecting to %s



Follow

Get every new post delivered to your Inbox.