Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-28-2008, 08:52 PM   #1
LQ Newbie
Registered: Jan 2005
Posts: 29

Rep: Reputation: 15
Pipe output of find through rm?

I am trying to locate some rogue files on my machine (I know the name or some form of it since I put them on the machine...) I know I can find them by using find

find / -name "libBooger*"
which should return the pathname of every file that begins with libBooger, right?

I also know that I can pipe output from a command through grep. For example if I do this

find / -name "libBooger*" | grep Brain
Then the output would be all files starting with libBooger and containing Brain somewhere in the pathname, right?

Ok, so what I want to do is use find to locate all of these rogue files, and then delete them as they are found... Can I pipe the output of find through rm? If so, how.... I know this

find / -name "libBooger*" | rm
Doesn't work...


(I don't fail... I succeed at finding all the ways that do not work)
Old 07-28-2008, 09:06 PM   #2
Senior Member
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
 find / -name "libBooger*" -delete
Old 07-28-2008, 09:15 PM   #3
LQ Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Or, for the exercise,

find / -name "libBooger*" -exec rm -f {} \;
Old 07-29-2008, 04:09 AM   #4
Senior Member
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 110Reputation: 110
Or, for another exercise:
find / -name "libBooger*" -print0 | xargs -0 rm


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Redirecting sh output to a pipe elmafiacs Programming 0 05-10-2006 02:55 PM
pipe find output to scp groundhog_killer Linux - Networking 2 02-14-2006 11:46 AM
how to pipe output from make BBB Programming 2 05-20-2005 07:14 AM
Read the output from a pipe with bash ? fluppi Linux - Software 3 01-13-2004 01:59 PM
Output truncated when using pipe tells Linux - General 1 12-16-2003 09:06 PM > Forums > Non-*NIX Forums > Programming

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

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