...
- To add a location to your PATH environment variable in Linux, you need to do the following:
Open a terminal and run the following command to open the .bashrc file in a text editor:
nano ~/.bashrc - Scroll to the bottom of the .bashrc file and add the following line, replacing /your/path with the location you want to add to the PATH variable:
export PATH=$PATH:/your/path
Note: You can add any environment variable in a similar way:
export VAR=/Some/path/
*Don't add spaces next to the '"=' " sign - Press CTRL + X to exit the editor, then press Y to save the changes and Enter to confirm the file name.
- Run the following command to apply the changes to the current terminal session:
source ~/.bashrc - Verify that the location was added to the PATH variable correctly by running the following command:
echo $PATH - You should see the new location in the list of paths that is printed to the screen. Keep in mind that you will need to open a new terminal or log out and log back in for the changes to take effect.
...