2

This question already has an answer here:

I'm using Ubuntu 14.04. I often use cd .. command in terminal. I want to replace the command with .. or some other shortcut.

Can I do that? If yes, how to do it?

marked as duplicate by Sylvain Pineau, Eric Carvalho, Pilot6, Mitch Jul 10 '15 at 15:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

This is usually called alias and not shortcut.

to do that:

alias CD='cd ..'

Now you can use the command CD instead of cd ..

But you have to note this will be just dynamic and you'll l ose all aliases when you close terminal and start again. To make it permanent you have to add it to your .bashrc.

Run the command

gedit .bashrc

Add the above line (alias declaration) then save and close and source the .bashrc using

source .bashrc

And now the alias CD is permanent .


You can list all aliases you use in your system(ubuntu come with some default aliases such as ls, egrep...), you can just type the command alias and you can list all aliases in the system

  • Worked like charm!! BTW, what does source .bashrc line does? – Abhishek Jul 9 '15 at 13:11
  • It just "fetch" i.e run the file, Execute commands from a file in the current shell. – Maythux Jul 9 '15 at 13:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.