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:


About these ads

10 Responses

  1. Thanks for the info, I forgot how to do this.

    However, is it recursive ? Say if I want to add ~/programs/programname/bin
    could I just add
    I PATH=~/programs/:”${PATH}” and it would find include all of the subdirectories within the /programs folder ?

    • I am not actually quite sure but think that it is not the case.

  2. Thanks Dude, I seems to always forget how to do this :)

    One more question for you:
    Say eg, I have add a new version of a java based tool (or whatever other program, that require a fresh installation instead that just upgrade the old version) and added its relative /whatever/bin to the PATH. Although bash will find the right executable, I would like to keep the PATH clean from old paths I don’t need anymore, how can I remove the old path entry from $PATH?


    • Sorry. I do not know the answer right away and have to search it out. But, I am so busy right now. Please google it out.

  3. I have the Path but still when I type as commandline, there is error command not founded

    • Did you restart your computer? That must do it or you did not give the right path.

      • I’m using Ubuntu 10.04 and a computer restart is not required. Just a terminal restart / new terminal window is required to take effect

  4. I have a program called “dlv.bin”
    another program will use it in order to work.
    how can I add it to my path so that other programs find it?

    notice that I placed “dlv.bin” in the “Home Folder”.

    • I am not quite sure how your program works, but the same procedure explained in this post may work for you.

  5. Thanks.. A Lot…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: