Skip to content Skip to sidebar Skip to footer

Creating command shortcuts in the Linux terminal

Creating command shortcuts in the Linux terminal

The shortcut on the computer is called an icon to bring up the program without opening the folder again. Usually, you need to click the icon to run it just like opening a program. But can you create a shortcut in the terminal?

Terminal is Command line interface (CLI) used to tell the computer what to do. Almost everything on the system can be easily done through the terminal. It just takes a very long command sometimes.

On all Linux operating systems, all lengthy commands that need to be executed in the terminal can be used as only as 1 short word. And the name of the function isn’t an abbreviation, however alias. It is suitable for those of you who often perform long commands without having to type long.

How to create command shortcuts in the Linux terminal

To add a shortcut, all you have to do is edit the file .bashrc are in the system and then add functions alias. This is not difficult to do, but make sure the syntax is spelled correctly so that there are no errors.

First, open Terminal and enter the following command to edit the bashrc file:

sudo nano /root/.bashrc

In order to add a shortcut afterwards, please pay attention to the following command first:

alias pintasan='command'

Change pintasan with the desired shortcut name. And change command with long orders. After changing, add the code to the very end of the bashrc file.

Then save the .bashrc file by pressing the button CTRL+X and keep pressing the button Y. After that, try running the link command as in the following example:

pintasan

If successful, the result will certainly correspond to the usual long command sequence.

Also read: tutorial on installing Webmin on an Ubuntu or Debian VPS

diploma

All in all, you only need the “alias“Just to link a long command. In conjunction with the tutorial above, it will be applied to root. Every time you run the command you ran previously, you must be in the root state or add it sudo Command prefix.

Below is an example of how the function can be used alias to stop the whole thing Screen> released or detached:

alias killdscr="screen -ls | grep Detached | cut -d. -f1 | awk '{print $1}' | xargs kill"

So if you add the above code to .bashrc all you have to do is type killdscr to prevent the screen from peeling off. If you have anything to ask, feel free to comment.

Hopefully useful and good luck