I read in an unofficial documentation about a Linux shell command called h: it was mentioned together with the help and man commands, without any explanation. So I tried it on my linux terminal but it returned a "command not found". I searched something about in internet but found nothing helpful. Does anyone know if this command exists? And, if so, what is its syntax and how does it work?

  • 4
    can you tell us why you're asking, why do you think there is a h command and what did your own research say? – pLumo Sep 17 '18 at 13:28
  • if your linux console does not refuse h command look at your ~/.bashrc file for the alias definition – schweik Sep 17 '18 at 13:43
  • @RoVo I read it in an unofficial documentation and my shell refused that command, so I searched something about on the web without any result – Joline Sep 17 '18 at 15:12

Like ll is a commonly defined alias for ls -l, h is a commonly defined alias for history or history <some-number>, history being a builtin command of csh to display the history (the commands you've previously run), now also found in bash, zsh (same as fc -l), ksh (as a pre-defined alias for hist -l) fish and yash (as a pre-defined function).

Trying to dig some old examples, see this old usenet post from 1984 for instance.

If you've read it mentioned in some documentation, the author might have had that alias in their ~/.cshrc/~/.bashrc... or used systems where that alias was defined system-wide. Given that they mention the help command which is the name of a builtin of the bash shell, that might have been the shell they had in mind.

To know what h is in your shell, type type h if using a Bourne-like shell or fish, or which h if using tcsh or whatis h if using rc/es... In csh, see if alias h returns something. If they return that h is an alias for history, that alias was probably defined in one of the configuration files of your shell.

The actual syntax of history will vary with the shell. Look at your shell documentation for details (info bash history for the bash shell for instance).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.