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.
Display the currently remembered location for getopt:
$ hash -t getopt
Remove the entry for getopt:
$ hash -d getopt
hash is a bash built in command: $ help hash
“Remember me when I am gone away, Gone far away into the silent land...” ~ Christina Georgina Rossetti
Related macOS commands:
history - Command History