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.

Read more at LinuxPlanet

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word