20

I am interested to hear about the history because I have a prominent command line product that has decided to use -h for something that does not print a help message.

when did command line applications start using "-h" as a "standard" way to print "help"?

I guess it would be interesting to hear when it first was started and also when it became a sort of "standard" thing to do. I guess it would also be interesting to hear what system in addition to the time.

1
  • Plenty of network software uses ‘-h’ to specify the host name.
    – RonJohn
    Mar 16, 2023 at 5:01

3 Answers 3

30

TL;DR Never

It is common, but far from universal. For example, the ls command to this day does not have -h for help. -h is for "human readable" with only --help for help.

My hunch is that older commands tended to use -h for other things, long before help was standard, and then later added --help. Arguably a new command should use -h and --help identically, a command that does not do so will not be in any way unusual.

16
  • 24
    From my observations, I think the '--help' might have originated with the GNU project...? At least, many of the double-dash command extensions in documentation seem to be referencing GNU extensions to traditional UNIX utilities. I am probably wrong here, but throwing the idea out there to see if it sticks :)
    – bjb
    Mar 15, 2023 at 16:26
  • 6
    @bjb true, the double hyphen convention was introduced by GNU guidelines for long options.
    – Raffzahn
    Mar 15, 2023 at 17:19
  • 29
    Worst are the programs that respond to -h with something like Type command --help for help. They know you're asking for help, but they refuse to provide it. So very Gnu.
    – scruss
    Mar 15, 2023 at 22:31
  • 8
    @scruss By returning an error message instead of doing something useful, this ensures nothing is ever coded to use -h for help, so it can be assigned in the future, without breaking compatibility.
    – user71659
    Mar 16, 2023 at 2:54
  • 8
    @scruss No it's not mean or them being cute, but a real software engineering issue. If they pasted the help text, people would simply ignore the --help message since it still does useful work. This is how APIs become bloated: somebody took advantage of unofficial or defective behavior and now you have to support it forever.
    – user71659
    Mar 16, 2023 at 4:19
19

I am interested to hear about the history because I have a prominent command line product that has decided to use -h for something that does not print a help message.

-h being help was never formally declared as standard. It's a (mostly) accepted convention. If a tool has a different, more sensible use for h, then it's up to that tool what to use.

Maybe because it's simply the most easy to guess single character to come up with when having no idea how a utility works or how to ask for more information.

I guess it would be interesting to hear when it first was started and also when it became a sort of "standard" thing to do.

I once heard this:


A Tale of Conquering the Frontier Land East of the Command Name

In 'ye olde times of total freedom' it was an anything goes - some may say a lawless time - out there in Computing Gulch.

Asking for help is an exceptional use, so quite often ? was chosen as that nicely leaves all letters free for regular use. But there wasn't any general preference for it versus using other brands. Some ranchers liked the h while others wanted to see a H.

Then sheriff POSIX was sent to town by the authorities in 1988. He was supposed to not only bring law to one town but all of the wild lands. One of his very first measures was to tame the command line with his 14 commandments of Utility Syntax Guidelines. Most relevant here are number three and four:

  • Guideline 3:

    Each option name should be a single alphanumeric character (the alnum character classification) from the portable character set.

  • Guideline 4:

    All options should be preceded by the '-' delimiter character.

Thus the humble question mark had to leave the town, -h became for many the place to ask for help. And while h wasn't really enforced, it became an accepted convention

All was nice, and the citizens of Computing Gulch did like the new cleaned up environment. Still it was a frontier place with mighty ranchers driving their GNU to town to ship them worldwide. While they liked the new conformity, they had to maintain their status as the true powers behind and insisted to tweak those 14 into Nine. At the same time felt there was still something missing. Not at least as their cattle were of course the most mighty and capable of all. They were sure that even twice 26 letters weren't enough.

So GNU introduced the long option name as part of their Program Argument Syntax Conventions. They shunned anyone calling it bloaty. To pacify their fellow citizens they added another hyphen (--option). In fact, this worked better than expected as --help can now be used everywhere, even in saloons where if -h was reserved for handling the holster rack.

That's the way law and order was brought to Command Line Valley and everyone lived happy ever after.


Of course this is just a single tale, colported by news papers and pulp 'literature'. Other valley and villages may have had different experience and still live by different conventions.

I guess it would also be interesting to hear what system in addition to the time.

While command line parameters date back to 'ancient' systems like Multics or TOPS-10 (*1), the whole modern origin is ofc. *NIX. So pick anything inbetween PDP-11 to 8086 or thereafter.


*1 - Or RDOS/AOS when it comes to the MS-DOS/Windows separator of '/'.

11
  • 5
    -? is some sort of cultural appropriation from Windows, which generally uses /? for 'help'.
    – dave
    Mar 16, 2023 at 1:07
  • 2
    @another-dave That's extremely plausible, but is it definitely true? Did Windows make it up it steal/inherit it from somewhere else? Mar 16, 2023 at 5:01
  • 1
    /? might be reasonable for Windows, but not on a Unix-like system where the shell expands * and ? wildcards before the program ever sees them.
    – dan04
    Mar 16, 2023 at 17:39
  • 2
    @user1686 I think, the source of all “xyz is for help” myths is the fact that programs back then didn’t have a special help option but just printed the usage when encountering an unknown or wrong option so you could sell any actually invalid option as “help option” because it apparently worked. The long help text still was requested with “man command” though.
    – Holger
    Mar 17, 2023 at 8:02
  • 1
    @Raffzahn, huh? The point was that -? would be a really bad choice because of how it interacts with other features. I don't think that has anything to do with the lack of a unified choice per se, as e.g. -h and -H would not have that problem, even if there was no general agreement on which one to use. (Of course, the way globbing works depends on the shell, and it might have been different in the olden days, but IIRC csh isn't any newfangled thingy, so that issue might have existed a while.)
    – ilkkachu
    Mar 18, 2023 at 8:22
5

Python got a -h option in version 2.0, released in 2000. Vim got a -h option in version 5.0, released in 1998. Curl, originally released in 1998, had an -h option from the beginning. So, I would guess that it started around 1998. (I'm sure there are earlier programs that have -h for help, but those are some of the more prominent programs that I can think of that have it.)

And DOS has /? quite some time before that, but that's not -h, though it has the same purpose.

However, the standard way to get help on Unix has always been through man. POSIX doesn't specify -h to mean help for any utility. For some, like file, it has an entirely different meaning, but most don't have any particular meaning for -h. For many programs, still, help is provided only through the man page, and there is no command line option for it.

4
  • 6
    unless you're gnu, then it's the interminable info system and a man page that reads Read the info page!. Blecch.
    – scruss
    Mar 16, 2023 at 4:04
  • 8
    @scruss info was utterly misguided. Nobody wants a help system that is harder to use than the command you are trying to get help on.
    – JeremyP
    Mar 16, 2023 at 9:27
  • 6
    RE "Nobody wants a help system that is harder to use than the command you are trying to get help on": i think you have finally found the root cause of my anger every time i have to use info... it just is insane to have something like info to get help. (i have many many many MANY years of linux experience. i still to this day do not know how to use info.) Mar 16, 2023 at 12:03
  • 2
    Have you read the info info page?
    – dan04
    Mar 17, 2023 at 22:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .