/

Persisting Aliases and Configuration in the Fish Shell

Persisting Aliases and Configuration in the Fish Shell

One often overlooked aspect of configuring the Fish Shell is the persistence of aliases and other settings. While it might be convenient to define these configurations on the fly within the terminal, it’s important to know that they will be lost after a system reboot. To avoid this, it’s recommended to add these configurations to the ~/.config/fish/config.fish file.

For instance, let’s say we want to set the ls command as an alias for exa, a modern replacement for the conventional ls command. Additionally, we want to alias cat to bat, a tool that provides syntax highlighting and other enhancements compared to the standard cat command.

To achieve this, we need to open the config.fish file in a text editor and add the following lines:

1
2
alias ls exa
alias cat bat

This ensures that these aliases are automatically loaded every time a new Fish Shell session starts. By persisting these configurations in the config.fish file, we can be confident that the aliases and other settings will be retained even after a system reboot.

Remember, the config.fish file is not limited to aliases alone. It can also accommodate other configuration options specific to the Fish Shell. By leveraging this file, you can tailor the Fish Shell to your specific needs, making your command-line experience even more efficient and enjoyable.

It’s important to note that while this article specifically addresses the Fish Shell, the concept of persisting configurations applies to other shells as well. Understanding how to persist aliases and configurations can greatly enhance your productivity and overall command-line workflow.

tags: [“fish shell”, “aliases”, “configuration”, “persistence”]