Xargs -r0 vs xargs -0

xargs

I have seen examples on the web of xargs with the argument -r0. What does this argument mean? My man pages don't show any entries for –r0 nor do most man pages I have seen (e.g. http://linux.die.net/man/1/xargs)

Best Answer

-r0 is two flags. It is -r and it is -0.

From the xargs(1) manpage:

-r
If the standard input does not contain any nonblanks, do not run the command. Normally, the command is run once even if there is no input. This option is a GNU extension.

-0
Input items are terminated by a null character instead of by whitespace, and the quotes and backslash are not special (every character is taken literally). Disables the end of file string, which is treated like any other argument. Useful when input items might contain white space, quote marks, or backslashes. The GNU find -print0 option produces input suitable for this mode.

Related Question