Aug
30
The Joys of xargs
Posted by suvi under Tricks
xargs is an incredibly useful command: it takes in input and executes your chosen command on it: xargs command. Deceptively simple in concept; extremely powerful in execution. It’s most commonly used to execute one command on the output from another command (command1 | xargs command2), and most often the output-generating command is find (xargs is more flexible than the built-in -exec option). Here we’ll look at xargs with find, and then at some other possibilities.
A couple of options which are useful for testing: -t echoes the command before executing it, and -p echoes it and asks for confirmation.
Leave a Reply