Xargs Command Lines – How to Show Without Running

xargs

A fair number of linux commands have a dry-run option that will show you what they're going to do without doing it. I see nothing in the xargs man page that does that and no obvious way to emulate it.

(my specific use case is troubleshooting long pipelines, though I'm sure there are others)

Am I missing something?

Best Answer

Put an echo in front of the command to run?

$ echo a b c d e | xargs -n2 echo rm
rm a b
rm c d
rm e