-r or -R?

March 24th, 2009

Many unix commands have an option to recursively apply a command to a directory and its files/subdirectories. Almost always the option is -R. Sometimes you can use little -r as well, and sometimes little -r does something different.
commandlittle -rBig -R
lsreverse sortrecursive
rmrecursiverecursive
chmodmess things uprecursive
svnrevisionrecursive
greprecursiverecursive

I’m in the habit of using little -r for rm and grep. Most examples I see use this, not sure if it’s because it’s one less key to press or if historically -R didn’t work. But this means I’m also in the habit of using -r for chmod, which will print an error message and also make my directory unlistable. So I should probably get in the habit of using -R…

(I tried this on OSX, FreeBSD, and Linux)

Sorry, comments are closed for this article.