LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-07-2011, 12:06 AM   #1
vivanguarda
Member
 
Registered: Sep 2008
Location: RJ-Brazil
Distribution: Slackware
Posts: 181

Rep: Reputation: 5
Looking For Several /home Arquives


Is it possible to use a command/options ( find, slocate, locate, grep...) and to find multiple (10) arquives (.dcop,.firefox,.cache,.kde,.kderc, .config,.Xauthority,.local...) in /home/user directory and remove after that?
 
Old 09-07-2011, 12:57 AM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Posts: 5,818

Rep: Reputation: 1005Reputation: 1005Reputation: 1005Reputation: 1005Reputation: 1005Reputation: 1005Reputation: 1005Reputation: 1005
Hello,

You could use the find command, and use the -exec flag to perform rm to the found files that you are looking for. Check out the man page here for more information - http://unixhelp.ed.ac.uk/CGI/man-cgi?find

Cheers,

Josh
 
Old 09-07-2011, 07:21 AM   #3
vivanguarda
Member
 
Registered: Sep 2008
Location: RJ-Brazil
Distribution: Slackware
Posts: 181

Original Poster
Rep: Reputation: 5
Thanks! I understand exec option to use rm.

I would like before searching a lot of config files. Then, is it possible to use a command to find 2 or more files?

For instance:

1)find . -name .cache (ok!)
2)find . -name .mozilla (ok!)
3)find . -name .wine (ok!)
...

How can I use 1,2 and 3 in a unique command?

Last edited by vivanguarda; 09-07-2011 at 08:01 AM.
 
Old 09-07-2011, 08:32 AM   #4
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,961

Rep: Reputation: 704Reputation: 704Reputation: 704Reputation: 704Reputation: 704Reputation: 704Reputation: 704
Quote:
Originally Posted by vivanguarda View Post
Thanks! I understand exec option to use rm.

I would like before searching a lot of config files. Then, is it possible to use a command to find 2 or more files?

For instance:

1)find . -name .cache (ok!)
2)find . -name .mozilla (ok!)
3)find . -name .wine (ok!)
...

How can I use 1,2 and 3 in a unique command?
Hi,

try something like this:
Code:
find /path/to/dir/ \( -name 'name1' -o -name 'name2 \) -print
# OR simply
find /path/to/dir/ -name 'name1' -o -name 'name2'
 
Old 09-08-2011, 11:43 AM   #5
corp769
LQ Guru
 
Registered: Apr 2005
Posts: 5,818

Rep: Reputation: 1005Reputation: 1005Reputation: 1005Reputation: 1005Reputation: 1005Reputation: 1005Reputation: 1005Reputation: 1005
Crts beat me to it; Use what he stated, and once you experiment around and get what you are looking for, append the exec flag with rm, and you will be set.
 
Old 09-12-2011, 07:42 AM   #6
vivanguarda
Member
 
Registered: Sep 2008
Location: RJ-Brazil
Distribution: Slackware
Posts: 181

Original Poster
Rep: Reputation: 5
Crts and corp769, thanks a lot!

Looking for another way, is it possible compares two directories (A) and (B) using arquives names and delete only that contained in (A) but preserves (B) fully?


(A)-/home/normal
(B)-/backup
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] vsftpd chrooting users that have been jailed into /home/jail/home/$username. amonamarth Linux - Server 4 07-09-2011 07:29 PM
LXer: Home, Sweet Home: Sweet Home 3D 2.1 Linux Version LXer Syndicated Linux News 0 10-06-2009 04:10 PM
contents of 'home' directory found at sda5: mounted as /home, and also on sda6:/home leswatson Linux - Newbie 4 04-18-2008 05:02 PM
Put a 2nd kanotix at hdb 3/,-4/home. 1st is at hdb8/,-9/home.#2 is using 1st's /home sleekmason Linux - General 3 12-09-2006 10:21 AM
want to ssh/ftp to home machine (Slack) from office through home router fincher69 Linux - Networking 2 09-21-2005 11:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration