3

Don't ask why, but is there a Unix command that takes no arguments?

closed as too broad by Kusalananda, Jeff Schaller, Christopher, A.B, penguin359 Jan 11 at 0:01

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Are you looking for a command that would error if given arguments, or that just don't process their arguments? I'm not immediately thinking of any in the former category (though one would be easy to create, and they may well exist), but the latter category has various examples. And of course there are many unix commands that do something useful without any arguments, but I'm guessing that's not what you're asking. – lindes Feb 22 '11 at 9:56
  • 10
    I can't help myself. Why? :P – gnud Feb 22 '11 at 14:11
  • Without further explanation what the issue is, whether "arguments" means options or operands or both, or why the question is asked in the first place, the question is unclear and too broad. – Kusalananda Jan 10 at 9:45
4

true and false are two examples.

Or did you mean commands that take no options? I can't think of any, but the original Unix version of echo didn't take any options. There's even a story about it how it came to take options.

  • yes is another one. – asoundmove Feb 22 '11 at 12:44
  • 2
    @asoundmove yes doesn't require an argument, but it does accept/use one. – gnud Feb 22 '11 at 13:43
  • 1
    As is so often the case, this largely depends on what Unix implementation you are using. Yes, POSIX doesn't specify any arguments for true, but that doesn't stop the GNU project: true --help yields Aufruf: /bin/true NAME oder: /bin/true OPTION Aufruf: %s [ignorierte Kommandzeilen-Argument] oder: %s OPTION Mit einem Status-Code beenden, der erfolgreiche Ausführung signalisiert. (21 lines total.) You'll notice that it is even localized! – Jörg W Mittag Feb 22 '11 at 19:32
2

nologin takes no arguments and is widely available on Linux and BSD.

On CentOS 4 and 5, the arch command takes no arguments. On other linux distros, arch is now provided by GNU coreutils which takes --version and --help. With CentOS 4 and 5 it comes from util-linux which differs from GNU's version.

A lot of the things in GNU coreutils take only --help and --version, if you look at different Unixes that don't use GNU coreutils, they don't accept any arguments: sync, true, false, whoami, pwd, groups, users

2

:, true, false, reset, clear, line, chkdupexe and arch all take no arguments.

I'm sure they accept them, but they ignore them.

  • OMG.. true and false are commands!... must try this: true; echo $? ... 0 | false; echo $? ... 1 ... yup! ... an ineresting bit if info... bash is different :) – Peter.O Feb 22 '11 at 17:17
0

If you accidentally run docker ps a (instead of docker ps -a) you'll actually get a message:

"docker ps" accepts no arguments.

Kinda reminds me of my wife.