When I started using ubuntu I used to type every command in terminal untill i got to know how to add shortcuts for any command you run in terminal.

Here is the easiest way to get rid of typing and remembering long commands in terminal. Just follow the steps below:

Step 1:

Create a new file in your home directory and name it ".bash_aliases".

Step 2:

Add your command like this:

h(){ cd /var/www/html;}

Note: Here space is required between "{" and your command otherwise you will get error in terminal.

First part in the above line is the shortcut "h" which i want to add for the "cd" command that is to "change directory" to "/var/www/html/" inside the terminal.

Second part is parenthesisĀ  like this "()" which represent a function.

Third part is opening of the curly brases "{"

Fourth part isĀ  your actual command "cd /var/www/html"

And last part is a semi colon and closing curly braces.

Step 3:

You can add as many shortcuts as you want and save the file.

Step 4:

Open the terminal and just type "h".

Add Your Own Shortcuts For Terminal Commands

That's just it!!!!

Sharing is caring. Please Share!