Skip to content

Instantly share code, notes, and snippets.

@ivansaul
Last active June 2, 2026 19:00
Show Gist options
  • Select an option

  • Save ivansaul/08166a29d84d67016bdf866c6c1e3251 to your computer and use it in GitHub Desktop.

Select an option

Save ivansaul/08166a29d84d67016bdf866c6c1e3251 to your computer and use it in GitHub Desktop.
Create alias in Fish shell and save this as a permanent.

Create a Permanent Alias in Fish Shell

Method 1

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 foo

This creates the file ~/.config/fish/functions/foo.fish, making the alias available in all future Fish sessions.

Method 2

I prefer this method because it allows me to manage all my aliases in a single file.

  1. Open ~/.config/fish/config.fish in your favorite editor. If the file doesn't exist yet, create it.
  2. Add the aliases you want to use.
  3. Save the file.
  4. Reload the configuration:
source ~/.config/fish/config.fish

Since 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.

@DaytonFishell

Copy link
Copy Markdown

you're awesome!

@Menme91

Menme91 commented Jun 2, 2026

Copy link
Copy Markdown

Thanks a lot, man, I was going crazy trying to find it. I’m a beginner, so this might be obvious, but once you’ve written the command using the second method, you have to close the terminal and reopen it. I couldn't figure out why it wasn't working for me, and then I found the reason.

@ivansaul

ivansaul commented Jun 2, 2026

Copy link
Copy Markdown
Author

Thanks a lot, man, I was going crazy trying to find it. I’m a beginner, so this might be obvious, but once you’ve written the command using the second method, you have to close the terminal and reopen it. I couldn't figure out why it wasn't working for me, and then I found the reason.

You're welcome!

Just as a small note, you don't actually need to close and reopen the terminal. After editing ~/.config/fish/config.fish, you can reload the configuration with:

source ~/.config/fish/config.fish

That will apply the changes immediately to your current Fish session. Reopening the terminal works too, since Fish automatically loads config.fish when it starts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment