How to add path variable(s) in linux/ubuntu?

Question:  How to add path variable(s) in linux/ubuntu?

Answer: You can use the following methods, the difference is in the 1st method, system forgets path variable when you log out but in the second one it does not forget till you edit .bashrc file.

1st method;

run bash command in terminal; ‘$ export PATH_VARIABLE_NAME=PATH’

2nd method;

open ~/.bashrc file and edit it by adding ‘$ export PATH_VARIABLE_NAME=PATH ‘

-> you can edit by running ‘$ nano ~/.bashrc’ add above line to the end of the document and hit ‘CTRL + X’ , hit ‘Y’, hit enter.

either restart the terminal or run ‘$ source .bashrc’

test your new path ‘$ echo $PATH_VARIABLE_NAME’

note: make sure you dont have any spaces between PATH_VARIABLE_NAME and PATH

This slideshow requires JavaScript.

Advertisements

About Firat Karakusoglu

IIT Tech.

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

%d bloggers like this: