Bash - Hash (Builtin command)

> Procedural Languages > Bash Shell and (Unix|Linux) Utilities (XCU)

1 - About

3 - Syntax

hash [-lr] [-p filename] [-dt] [name]

For each name, the full file name of the command is determined by searching the directories in $PATH and remembered.

  • -p: no path search is performed, and filename is used as the full file name of the command.
  • -r: forget all remembered locations.
  • -d: forget the remembered location of each name.
  • -t: the full pathname to which each name corresponds is printed. If multiple name arguments are supplied with -t, the name is printed before the hashed full pathname.
  • -l: output is displayed in a format that may be reused as input.

If no arguments are given, or if only -l is supplied, information about remembered commands is printed.


4 - Exit value

The return status is true unless:

  • a name is not found
  • or an invalid option is supplied.

5 - Documentation / Reference