To shortcut your recently used commands in Ubuntu command line you can use bashrc aliases.

You can place your alias in ~/.bashrc file or to separate ~/.bash_aliases file.

I prefer second one to keep ~/.bashrc in original state.

So we need to open ~/.bash_aliases file for edit and put required aliases there.

vim ~/.bash_aliases

And add new line for each alias you need. For example:

alias upgrade='sudo apt-get update && sudo apt-get upgrade'

Save and close file using Esc -> :wq -> Enter

Now close terminal and reopen it to get new alias command.

Now check it:

user@ubuntu:~$ upgrade

It will ask you a password and then upgrade your system.

Next Post Previous Post