.Search and Destroy Command on Linux - Trancetronic
Close

Not a member yet? Register now and get started.

lock and key

Sign in to your account.

Account Login

Forgot your password?

Search and Destroy Command on Linux

Search and Destroy Command on Linux
 

Here’s a handy command that you can use to delete files from your Linux machine:

    find . -iname "filename.ext" -exec rm -fv {} \;

-> . means start with current directory
-> -iname means match the file mask in a case sensitive manner
-> “filename.ext” is the desired file name
-> -exec means run this command when a match is found
-> rm -fv command deletes the file verbosely, without asking
-> {} will be replaced with the name of the file found
-> \; is the command terminator

Change the “filename.ext” part of the command to suit your requirements. It can be "*.jpg", "*.mp3"″, or "thumbs.db". Leave the quotes as it is.

Leave a Reply