hash

Refresh the cached/remembered location of commands.
Logging out and in will refresh this automatically, but if you have just updated or reinstalled a package you might want to force an update.

Syntax
 hash [-lr] [-p filename] [-dt] [name]
Key
 -p Use filename as the full file name of the command (no path search is performed).
 -t Print the full pathname to which each name corresponds.
 -l Display output in a format that can be reused as input.
 -d Forget the remembered location of each name.
 -r Forget all remembered locations.

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

If multiple name arguments are supplied with -t, the name is printed before the hashed full pathname. If no arguments are given, or if only -l is supplied, information about remembered commands is printed.

The return status is true unless a name is not found or an invalid option is supplied.

This is a BASH shell builtin, to display your local syntax from the bash prompt type: help hash

Examples

Display the currently remembered location for getopt:

$ getopt
$ hash -t getopt

Remove the entry for getopt:

$ hash -d getopt

"Remember me when I am gone away, Gone far away into the silent land..." ~ Christina Georgina Rossetti

Related macOS commands

Local man page: hash - Command line help page on your local machine.
history - Command History.

(追記) (追記ここまで)
Copyright © 1999-2026 SS64.com
Some rights reserved

AltStyle によって変換されたページ (->オリジナル) /