Virus killer – an CLI magic

For most of the Linux and UNIX veterans out there the following post may be a little too silly; so pls don’t read.

Just now a friend of mine brought an iPod (the cool thing ever made) unfortunate for him every folder in the disk had a exe file named after the folder(surely the work of a virus).

Fortunate for me I knew the following command

$ls -d $PWD/*/* |grep .exe

Just passed the output of this to the rm command and wow the exes were gone. This works two levels into the directory.

This gives the absolute path of the files in the directory and grep greps the files that have the string exe.

Result: One happy iPod and three cheers for Linux simplicity. 😉


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

%d bloggers like this: