Manuel Ignacio López Quintero
Create a terminal shortcut in Ubuntu or Debian

The terminal is an excellent tool for developers, but sometimes you need to type large commands with multiple arguments or run an application with a long path. The best way to resolve this is using a terminal shortcut or alias (more appropriate).

The syntax is: alias yc='tc', where yc is your command and tc is the terminal command. For example, we will create an alias named clc with the following command that totally clear the terminal screen: echo -en "\ec".

1. OPEN YOUR TERMINAL

A terminal is a Command Line Interface (CLI) where you type commands to tell the computer what to do. Make sure you've opened the terminal, if so, continues in the next step.

2A. CREATE A SHORTCUT ONLY FOR YOUR USER

In your terminal, execute:

nano ~/.bash_aliases

Add the following line at the end of the file:

alias clc='echo -en "\ec"'

Exit with Ctrl + X and save the changes. Finally, execute bash in your terminal. Now you can start using your shortcut clc!

2B. CREATE A SHORTCUT FOR ALL USERS

In your terminal, execute:

sudo nano /etc/bash.bashrc

Add the following line at the end of the file:

alias clc='echo -en "\ec"'

Exit with Ctrl + X and save the changes. Finally, execute bash in your terminal. Now you can start using your shortcut clc!

Do you like this article? Share it with this link. Thanks for reading!