How to createcustom commands or rename existing ones?
Without any doubt, it is a question that many of us have done at least once, either for easy recall a command instruction we want to make more funny a command or save time by writing. Learn to how to do easy and simple way thanks to a command available in several shells, his name is "alias" (In all GNU / Linux) and other simpler form (For those with terminal Deepin) .
To do this we need to open our terminal, you can search launcher Deepin or the keyboard shortcut "Ctrl + Alt + T" after opening the terminal we can start creating aliases or nicknames for commands specific or complete instructions.
A specific command would be
sudo and a full statement would be
sudo apt updateIn both cases, you can create an alias, with minor differences.
For the first we might think of something that makes us help you remember the "sudo" command command, used to run a command with elevated or "root" or administrator privileges, so you could put a nickname to this command. Examples:
alias administrador=sudo Easier to remember.
alias s=sudo To write faster.
alias sudar=sudo To fool around, you can invent the command you want.
Now, suppose we will open the Synaptic package manager or anything else with elevated privileges or need "sudo" in the terminal, we could use our new command "sweat"
However, when there is a single command, but a complete instruction as could be
sudo nano /etc/apt/sources.list(This address is where addresses are stored repositories), then, should be done using simple '' 'quote or quote the English' '' and wrapped the entire command between two of them. Examples:
alias repositorios='nano /etc/apt/sources.list'2nd Example:
alias actualizar='sudo apt update'3rd Example
alias mejorar="sudo apt full-upgrade"
alias instalar='sudo apt install'
Then, using one of our new commands in the terminal, would something like this:
As you can see, it is very easy and simple, you will keep the original commands but also have these that will make use of something more fun and less frightening terminal, in the event that you want to delete an alias or nickname, we would use the command
unaliasfollowed by the name. Examples:
Then note that when writing instruction
instalar vlcwould "command not found"
To see the list of aliases you've invented you can only use the command
All this was for educational purposes because if you get too lazy, you can simply create a custom command by right clicking on the menu Deepin terminal and press the option that says "Custom Commands"
Then to use it you would have to open the terminal and press it every time you go to use it, rather than typing a command in the terminal on your own.
Using aliases allow us to adapt to the terminal, handle a little better and faster.