How to create an alias on linux

July 20, 2021

First, you have to figure out what shell you are using. This can be done by running this command:

echo $SHELL

In my case it's zsh. Depending on what shell you are using you will have to configure the aliases in different locations.

  • zsh: ~/.zshrc
  • bash: ~/.bashrc
  • Fish: ~/.config/fish/config.fish

Now open the file in your favorite editor.

vi ~/.zshrc

And add the following line:

alias list="ls"

Now you have to restart your terminal.

After restarting the terminal you now can type list to execute the ls command.