Make aliases in ubuntu

twitter logo github logo ・1 min read

Easiest way to make aliases of often used commands is to open file manager and then hit ctrl-h to show the hidden files. Open the .bashrc file and scroll down to the bottom of the file

The syntax is alias='commands'

For example you can combine these two commands with a simple alias

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

Now save the file, open a terminal window and hit 'ago'

I like to hit 'ls' everytime I cd into a folder just to get a view of the newly entered folder so therefore i like to combine the cd command with a ls. However, this kind of command needs a function as opposed to an alias


function cd {
builtin cd "$@" && ls

hit save and open up a new terminal window and test it

twitter logo DISCUSS (2)
markdown guide

When you have a terminal open already you can type source ~/.bashrc and it will recompile your bashrc file and you don't have to open and close the terminal. Helpful if you are using nano/vim/emacs to edit the bashrc file


If you work in linux long enough, eventually you will find also . file.sh (a dot and then a shell file) which is basically the same of source file.sh :)

Classic DEV Post from Mar 22 '19

Work faster with Git aliases

Common Git aliases I use every day

BruxDev profile image
Norwegian, father of one, runner, prefers JAVA, love to play around with fullstack. Currently wrestling with React.js.

Customize your DEV feed to keep up with the technologies you care about.

Get Started