Delete File Recursively In Linux

Posted: November 21, 2009 in Open Source, Open Source Tutorial
Tags: , , ,

This commands below are quite effective to remove virus if your filesystem are being shared (for example, there are some clients that are accessing your linux filesystem using samba).

Find all files having .bak (*.bak) extension in current directory and remove them:
$ find . -type f -name "*.bak" -exec rm -f {} \;

Find all core files and remove them:
# find / -name core -exec rm -f {} \;

Find all *.bak files in current directory and removes them with confirmation from user:
$ find . -type f -name "*.bak" -exec rm -i {} \;


Leave a Reply

Fill in your details below or click an icon to log in: Logo

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

Google+ photo

You are commenting using your Google+ 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