A Linux user’s PATH is a list of directories that the Linux system searches for executable programs. The default Linux PATH includes many standard utilities, but it does not include all of them. If you are using Linux Ubuntu, this article will teach you how to add a permanent path to your PATH in Linux Ubuntu.
To add a permanent path to the PATH in Linux Ubuntu, you will need to edit the ‘PATH’ variable in your ‘.bashrc’ file. The ‘.bashrc’ file is a configuration file that is read by the Bash shell every time you start a new terminal session. To open the ‘.bashrc’ file, type the following command into a Linux terminal:
You can add a permanent PATH in Windows as well using this post.
If you are unfamiliar with Linux, you might not know what to do next. follow my instructions below instead of proceeding on your own. To edit the ‘.bashrc’ file as described above in Linux Ubuntu, type the following command into a Linux terminal:
sudo nano ~/.bashrc
The ‘.bashrc’ file should now be open in the Nano text editor. Scroll down to the bottom of the file and add the following line:
Replace ‘/directory/to/add’ with the actual path to the directory that you want to add to your PATH. For example, if you wanted to add the ‘/usr/local/bin’ directory to your PATH, you would type the following line into the ‘.bashrc’ file:
Reload and Test
Once you have added the desired path to the ‘.bashrc’ file, save the file and close it. You can now test your changes by starting a new Linux terminal session or reloading the shell using the command below.