# How to create aliases for your commands

Imagine reducing the command below:

```plaintext
git fetch && git checkout develop
```

to a shorter version:

```plaintext
gfc develop
```

> Every time you type a full command when you could have autocompleted, or click when you could have used a shortcut key, you're expending precious limited cognitive power. Keep learning shortcuts for repetitive actions.

In the above command, the command `git fetch && git checkout` is replaced with the alias `gfc`. This alias could be whatever you wish to term it but make sure to avoid using already defined keywords (e.g npm, cd, touch, git, etc).

To set up an alias on your system. The first thing you need to do is to locate or create the file, `.zshrc` or `.bashrc` (depending on the shell you are using) in your home directory (~).

```plaintext
Mac - "/Users/your-username/.zshrc" 

Linux - "/home/your-username/.zshrc"
```

Next, open the file with any editor of your choice, in this tutorial, I'll be making use of `nano` text editor.

To open the file, launch your terminal, type `nano ~/.zshrc` and press enter. Then go to the bottom of the file and add a few aliases with the following syntax:

```plaintext
alias alias_name='command to be replaced'
```

![Screenshot 2021-09-28 at 01.46.23.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632790014897/WEOxW73UV.png align="left")

Done adding these new exciting aliases?😃 You can exit the nano editor by pressing `ctrl + x` , then press Y to save changes and then press the enter key.

![Screenshot 2021-09-28 at 01.53.21.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632790435740/SsiuQF9L1.png align="left")

Restart your terminal and try out these new aliases 🥂.

Happy aliasing!
