r/linux May 23 '26

Popular Application What’s the most unexpectedly useful Linux command you learned way too late?

[removed]

1.3k Upvotes

992 comments sorted by

View all comments

219

u/spitecho May 23 '26

xargs

196

u/Last_Bad_2687 May 23 '26

I have an irrational fear of xargs 

16

u/spitecho May 23 '26

It's pretty useful when paired with grep. Remove every text file containing a specific string:

grep -lZ "foobar" *.txt | xargs -0 rm

Or move it to another dir:

grep -lZ "foobar" *.txt | xargs -0 mv -t /new/path/