Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
01-11-2010, 08:25 PM
|
#1
|
Member
Registered: Apr 2009
Distribution: OpenSuse, Slackware
Posts: 70
Rep:
|
find worms that have same name *.exe with the directory ???
Hi all, is there any way to find and delete the worm with extension .exe files but the name is same with the directory.
Ex:
/home/master/
/home/master/master.exe
/g.xls
so that worm name is master.exe with located under directory master, as i know sometimes the sizes of bytes is different.
Need advices please,
Thank's a lot
|
|
|
01-11-2010, 08:53 PM
|
#2
|
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,712
|
Quote:
Originally Posted by b-RAM
Hi all, is there any way to find and delete the worm with extension .exe files but the name is same with the directory.
Ex:
/home/master/
/home/master/master.exe
/g.xls
so that worm name is master.exe with located under directory master, as i know sometimes the sizes of bytes is different.
Need advices please,
Thank's a lot
|
Read the man pages for the find and rm commands. For example, to find all .exe files under /home and delete them:
Code:
rm `find /home -name *.exe`
note those are backticks (to the left of the 1 key), not single-quotes.
|
|
|
01-11-2010, 09:17 PM
|
#3
|
Senior Member
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187
|
Can't you just ignore them? The .exe extension is meaningless on Linux and UNIX systems. (And, for what it's worth, almost any other modern operating system.)
|
|
|
01-11-2010, 09:31 PM
|
#4
|
Member
Registered: Nov 2009
Location: Chicago
Distribution: Arch and OpenBSD
Posts: 104
Rep:
|
Why would you need to bother with .exe files. Your on linux now
Read it
http://tinyurl.com/yd3sm3w
|
|
|
01-11-2010, 10:08 PM
|
#5
|
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,712
|
Quote:
Originally Posted by itsbrad212
|
True, but the OP may be trying to eliminate them on a Samba share. The drive may be Linux, but the other systems using it may be Windows.
|
|
|
01-11-2010, 11:54 PM
|
#6
|
Member
Registered: Apr 2009
Distribution: OpenSuse, Slackware
Posts: 70
Original Poster
Rep:
|
Thank's for all your replies, i had know about to find -name *.exe with the size usually i know for that worm the problem is the sizes of that worm exe files not same at all, if i just using find the exe files so the other exe files on my home directory will be wiped out by command
so i, and for TB0ne you're right it's in samba share so sometimes it's affect the windows client. ^^
Thank's a lot and need advices please. ^^
|
|
|
01-12-2010, 12:17 AM
|
#7
|
Member
Registered: Nov 2008
Location: San Francisco, CA
Distribution: Gentoo, CentOS
Posts: 71
Rep:
|
Searching for a file with the same name as its parent directory is rather outside the scope of the shell globs supported by 'find -name'. Find's regular expression support, however, can handle it just fine. Try the command below.
Code:
find /path/to/share -regex '.*/\([^/]+\)/\1.exe' -print0 | xargs -0 rm
Here's the breakdown of that regex:
.* matches as much as it can of anything
/ matches a literal '/'
\( opens a capture group
[^/]+ matches one or more characters that are not '/'
\) closes the capture group
/ matches a literal '/'
\1 matches whatever was matched by the capture group
.exe matches literal ".exe"
|
|
1 members found this post helpful.
|
01-12-2010, 12:28 AM
|
#8
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.x
Posts: 18,440
|
You do know about the
-type f
option to find ?
http://linux.die.net/man/1/find
|
|
|
01-12-2010, 12:42 AM
|
#9
|
Member
Registered: Apr 2009
Distribution: OpenSuse, Slackware
Posts: 70
Original Poster
Rep:
|
Hi Chrism01, -type f is it for regular file isn't it ? (correct me if i'm wrong ^^), yeah i've used it when try to check if there's still that exe files:
find /home/* -type f -name *.exe -size 42710c -exec rm -f '{}' \;
but sometimes the sizes different so if i don't use -size i'm afraid it will be deleted all files exe on my samba share, and thank's a lot Elemecca for explaination it's very useful enlightment ^^.
Regards,
b-RAM
|
|
|
01-12-2010, 03:11 PM
|
#10
|
Member
Registered: Nov 2009
Location: Chicago
Distribution: Arch and OpenBSD
Posts: 104
Rep:
|
Quote:
Originally Posted by TB0ne
True, but the OP may be trying to eliminate them on a Samba share. The drive may be Linux, but the other systems using it may be Windows.
|
Ahhh. Never thought of that. How many .exe's is he looking at deleting?
|
|
|
01-12-2010, 05:45 PM
|
#11
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.x
Posts: 18,440
|
The trick is to come up with a clear set of rules that define the list of files to be eliminated, otherwise you'd have to do it by hand. Don't think I'd use -size, but it depends what you system looks like.
You might need to write a short script, not just a one-liner.
|
|
|
01-12-2010, 06:12 PM
|
#12
|
Senior Member
Registered: Mar 2009
Location: USA
Distribution: Arch
Posts: 1,022
Rep: 
|
Quote:
Originally Posted by PTrenholme
Can't you just ignore them? The .exe extension is meaningless on Linux and UNIX systems. (And, for what it's worth, almost any other modern operating system.)
|
HaHa. I caught that. Nice One.
|
|
|
01-12-2010, 06:55 PM
|
#13
|
LQ 5k Club
Registered: Sep 2009
Posts: 6,443
|
Quote:
Originally Posted by itsbrad212
|
Good link, but why do you use tinyurl? It doesn't let me see the real URL in the fist place, and then forces me to wait through an ad on a creepy website before I get to the page.
|
|
|
All times are GMT -5. The time now is 11:35 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|