Ubuntu – How to create a path shortcut


I have a very beginner question. I would like to create a shortcut to a directory that is global so that when I do something like

cd $dir

It will take me to the specified directory. Or if I am prompted to specify a download path in some program I can just input $dir into the field.


Best Answer

You have to keep the path of that directory in a global variavble. For example:

export DIR="/path/to/directory"

To make the change permanently, add the above line to your ~/.profile file.