I know in Bash and similar shells, there is the hash
command, which gets run when the user runs a non-builtin command, and cleared when (for example) you update $PATH
or run hash -r
.
And I know that the Fish shell includes the history
command, which also gets updated when you run a command and cleared when running history clear
. But the purpose of the history
command doesn't seem to be to cache paths to command files, as with Bash's bash
command. I'm basing this on the contents of my local ~/.local/share/fish/fish_history
file, which seems to include the commands and the timestamps they were run, but no absolute paths to command files:
- cmd: history
when: 1697724735
- cmd: exit
when: 1697724738
- cmd: history clear --help
- cmd: cat ~/.local/share/fish/fish_history
when: 1697805134
paths:
- ~/.local/share/fish/fish_history
So my question is- does Fish have a similar command cache to Bash?
No, there is no command cache in fish, and so no need for a hash
command. $PATH
is searched for every external command.