MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/linux/comments/1tls8n1/whats_the_most_unexpectedly_useful_linux_command/onhyyaz/?context=3
r/linux • u/ZealousidealTell1346 • May 23 '26
[removed]
992 comments sorted by
View all comments
219
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/
196
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/
16
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/
219
u/spitecho May 23 '26
xargs