Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How do I perform 2 commands within 1 line that the first perform action on the 2nd's result? For example, if I want to remove all the results of a certain path list given to me by "locate" (rm -rf > locate text.ext), how would I go about that?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

You're not far off :) ... one way of doing it would be:

locate text.ext | xargs -i rm -rf "{}"
share|improve this answer
Worked like a charm. – user148366 Dec 21 '12 at 1:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.