Common options (GNU Coreutils 9.0)
2 Common options
Certain options are available in all of these programs. Rather than writing identical descriptions for each of the programs, they are described here. (In fact, every GNU program accepts (or should accept) these options.)
Normally options and operands can appear in any order, and programs act as if all the options appear before any operands. For example, ‘
sort -r passwd -t :’ acts like ‘
sort -r -t : passwd’, since ‘
:’ is an option-argument of
-t. However, if the
POSIXLY_CORRECT environment variable is set, options must appear before operands, unless otherwise specified for a particular command.
A few programs can usefully have trailing operands with leading ‘
-’. With such a program, options must precede operands even if
POSIXLY_CORRECT is not set, and this fact is noted in the program description. For example, the
env command’s options must appear before its operands, since in some cases the operands specify a command that itself contains options.
Most programs that accept long options recognize unambiguous abbreviations of those options. For example, ‘
rmdir --ignore-fail-on-non-empty’ can be invoked as ‘
rmdir --ignore-fail’ or even ‘
rmdir --i’. Ambiguous options, such as ‘
ls --h’, are identified as such.
Some of these programs recognize the
--version options only when one of them is the sole command line argument. For these programs, abbreviations of the long options are not always recognized.
Print a usage message listing all available options, then exit successfully.
Print the version number, then exit successfully.
Delimit the option list. Later arguments, if any, are treated as operands even if they begin with ‘
-’. For example, ‘
sort -- -r’ reads from the file named
A single ‘
-’ operand is not really an option, though it looks like one. It stands for a file operand, and some tools treat it as standard input, or as standard output if that is clear from the context. For example, ‘
sort -’ reads from standard input, and is equivalent to plain ‘
sort’. Unless otherwise specified, a ‘
-’ can appear as any operand that requires a file name.
|• Exit status||Indicating program success or failure.|
|• Backup options||-b -S, in some programs.|
|• Block size||BLOCK_SIZE and –block-size, in some programs.|
|• Floating point||Floating point number representation.|
|• Signal specifications||Specifying signals using the –signal option.|
|• Disambiguating names and IDs||chgrp, chown, chroot, id: user and group syntax|
|• Random sources||–random-source, in some programs.|
|• Target directory||Specifying a target directory, in some programs.|
|• Trailing slashes||–strip-trailing-slashes, in some programs.|
|• Traversing symlinks||-H, -L, or -P, in some programs.|
|• Treating / specially||–preserve-root and –no-preserve-root.|
|• Special built-in utilities|
|• Standards conformance||Conformance to the POSIX standard.|
|• Multi-call invocation||Multi-call program invocation.|