In Fish, an alias is actually implemented as a function. To make it permanent, you need to save the function using funcsave.
alias foo=bar
funcsave fooThis creates the file ~/.config/fish/functions/foo.fish, making the alias available in all future Fish sessions.
I prefer this method because it allows me to manage all my aliases in a single file.
- Open
~/.config/fish/config.fishin your favorite editor. If the file doesn't exist yet, create it. - Add the aliases you want to use.
- Save the file.
- Reload the configuration:
source ~/.config/fish/config.fishSince config.fish is loaded whenever Fish starts, your aliases will be available in every new shell session.
Enjoy!
Tip
If the alias doesn't work immediately, run source ~/.config/fish/config.fish or open a new terminal window to reload your Fish configuration.
you're awesome!