Do you like this article? Share it with this link. Thanks!
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'.
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.
There are two ways to create a shortcut: only for your user or for all users.
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
!
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!