Ubuntu- How to add a path to your path list in terminal (.bashrc file)

Suppose you would like to have access to a particular path from within terminal. For example, if you have your executables in a folder called ~/my_program/bin you may want to have access to the executables from everywhere within terminal. One way to achieve this is to add that particular path to your path list in the “.bashrc” file. So, how to do that?

First launch a file browser and go to your home folder. You need then to edit the “.bashrc” file which is a hidden file in your home folder. You would therefore first need to make Ubuntu show your hidden files. In the menu bar on the top of the file browser window, select “View/Show Hidden Files” and check the mark . Here is a graphic for your reference:

View_hidden_ files

Then find the file “.bashrc” file and open it with the text editor. You would then need to append a line or two to the file. For example, if you would like to add the path~/my_program/bin, you would need to add the following line to the file:

PATH=~/my_program/bin:”${PATH}”

Follow

Get every new post delivered to your Inbox.