LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 01-08-2010, 10:51 AM   #1
networkingnub
LQ Newbie
 
Registered: Jul 2009
Posts: 16

Rep: Reputation: 0
RM command


Is there a way to do the rm command where I can remove files by owner.

I run the standard ls -al command and I want to be able to remove the files that are owned by me in that current directory.

One other step how can I remove files in all directories owned by me


Please and thanks I did the google search first guys and a majority of the pages just dealt with the basics like rm -r

What I have here is a little more specific....please and thanks.
 
Old 01-08-2010, 11:16 AM   #2
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,278

Rep: Reputation: 148Reputation: 148
On current directory
#find . -group groupname -user username | xargs rm -f {}\;

In different directory
#find /path -group groupname -user username | xargs rm -f {}\;

Last edited by kirukan; 01-08-2010 at 11:17 AM.
 
Old 01-08-2010, 12:08 PM   #3
Samotnik
Member
 
Registered: Jun 2006
Location: Belarus
Distribution: Debian GNU/Linux testing/unstable
Posts: 471

Rep: Reputation: 40
You don't need to use {}\ with xargs.
Should be
find /path -group groupname -user username | xargs rm -f
or
find /path -group groupname -user username -exec rm -f '{}'\;
 
Old 01-11-2010, 04:01 AM   #4
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,278

Rep: Reputation: 148Reputation: 148
Quote:
find /path -group test -user test -exec rm -f '{}'\;
I have received the following message...
Quote:
find: missing argument to `-exec'
whats wrong on the above mentioned command/
 
Old 01-12-2010, 06:21 PM   #5
Samotnik
Member
 
Registered: Jun 2006
Location: Belarus
Distribution: Debian GNU/Linux testing/unstable
Posts: 471

Rep: Reputation: 40
My fault :-(

Code:
find /path -group test -user test -exec rm -f '{}' \;
Space is significant.

Last edited by pixellany; 01-12-2010 at 06:42 PM.
 
Old 01-12-2010, 06:43 PM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
What space?? (I put the latest version in code tags for clarity)
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Only execute 2nd command on successufl execution of 1st command kregec05 Linux - Newbie 3 08-19-2009 10:29 AM
URGENT! Is there any command to get a history command lines and time in SUSE Linux.? igsoper Linux - Software 5 06-25-2009 02:14 AM
busybox command works, same command within script says permission denied jeroenv Linux - Newbie 2 01-17-2009 02:58 AM
LXer: The Linux Command Shell For Beginners: Fear Not The Command Line! LXer Syndicated Linux News 0 12-22-2008 06:30 PM
Translating windows pscp command to linux scp command help robward Linux - General 2 01-17-2008 06:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03: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