hash — Create a tracked alias

Format

Description

hash creates one or more tracked aliases. Each name on the command line becomes an alias that is resolved to its full path name; thus the shell avoids searching the PATH directories for the command whenever you issue it. A tracked alias is assigned its full path name the first time that the alias is used. It is reassigned a path name the first time that it is used after the variable PATH is changed or the shell command cd is used.

hash is a built-in alias defined with
alias hash='alias -t’

If you specify hash without any arguments on the command line, hash displays the current list of tracked aliases.

Options

–r
Removes all current tracked aliases.

Usage notes

hash is a built-in shell command.

Localization

hash uses the following localization environment variables:
  • LANG
  • LC_ALL
  • LC_CTYPE
  • LC_MESSAGES
  • NLSPATH

See Localization for more information.

Exit values

0
Successful completion
1
Failure because of an incorrect command-line option

Portability

POSIX.2, X/Open Portability Guide, UNIX systems.

Related information

alias, sh