Orion42 ~IT made easy~

Giving feedback, alpha testing and solving common problems with out of the box and lateral thinking

Linux, Bash and Git

[Linux] Add permanent Shell Alias to a folder

Do you have favourite folders that use to open every day on your terminal? Are you tired of browsing several folders every time to reach your working folders? If you answered yes, then this article is for you!

You will need to open your shell configuration file (in my case .bashrc in home\username\ ) and add an alias for the folder(s) you want to point. Once the file is saved you have added a permanent alias that can be executed every time you are in the terminal.

In general, you can use an alias to execute any command you want:

alias aliasName='command'

but in this case, you can just use it for browsing the folder you want:

alias folderAlias='cd /mnt/c/folder/sub-folder/sub-sub-folder/'

Once the config file is saved, you will need to restart the shell to reload the settings, in my case, using exec bash .

As an example, you can set cddev to access the dev folder in the d drive:

alias cddev='cd /mnt/d/dev'

 

LEAVE A RESPONSE

Skip to content