Fixing my PATH variable

Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I am perplexed by the following problem and hoping someone can help me fix it:
when I type echo $PATH, I get the output:
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
However, I modified my PATH variable using gksudo gedit; the file now reads
/etc/environmentPATH="/opt/texbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games".
I am not sure why I am getting two different value of PATH. How can I fix it?
I am running Xfce on a Chromebook using Crouton if that helps.
bash path
 |Â
show 8 more comments
up vote
2
down vote
favorite
I am perplexed by the following problem and hoping someone can help me fix it:
when I type echo $PATH, I get the output:
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
However, I modified my PATH variable using gksudo gedit; the file now reads
/etc/environmentPATH="/opt/texbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games".
I am not sure why I am getting two different value of PATH. How can I fix it?
I am running Xfce on a Chromebook using Crouton if that helps.
bash path
What command did you use to modify your PATH variable?
â cremefraiche
Apr 16 '15 at 21:38
@cremefraiche I used <code> gksudo gedit /etc/environment </code> and then added <code> "/opt/texbin"</code> saved it rebooted but still the same problem.
â DBS
Apr 16 '15 at 21:40
7
That is not the way you should be changing your path variable. If you are trying to change the PATH variable for the current user only, modify the line in~/.bashrcthat saysexport PATH=$PATH:.... All you need to do is add a colon to the end and include the path. Example:export PATH=$PATH:...:/new/path
â cremefraiche
Apr 16 '15 at 21:44
@cremefraiche thanks let me try that. Btw would you explain why editing the PATh in /etc/environment doesnt work?
â DBS
Apr 16 '15 at 21:46
2
From what I understand it is best not to mess with that file directly, in order to minimize risk of breakage. I should mention that~/.bashrcis run every time an interactive shell is opened, while~/.bash_profileis run when a login shell is opened. Pick which file best suits your needs.
â cremefraiche
Apr 16 '15 at 21:54
 |Â
show 8 more comments
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I am perplexed by the following problem and hoping someone can help me fix it:
when I type echo $PATH, I get the output:
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
However, I modified my PATH variable using gksudo gedit; the file now reads
/etc/environmentPATH="/opt/texbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games".
I am not sure why I am getting two different value of PATH. How can I fix it?
I am running Xfce on a Chromebook using Crouton if that helps.
bash path
I am perplexed by the following problem and hoping someone can help me fix it:
when I type echo $PATH, I get the output:
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
However, I modified my PATH variable using gksudo gedit; the file now reads
/etc/environmentPATH="/opt/texbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games".
I am not sure why I am getting two different value of PATH. How can I fix it?
I am running Xfce on a Chromebook using Crouton if that helps.
bash path
bash path
edited Apr 16 '15 at 21:53
dhag
10.8k32742
10.8k32742
asked Apr 16 '15 at 21:19
DBS
1277
1277
What command did you use to modify your PATH variable?
â cremefraiche
Apr 16 '15 at 21:38
@cremefraiche I used <code> gksudo gedit /etc/environment </code> and then added <code> "/opt/texbin"</code> saved it rebooted but still the same problem.
â DBS
Apr 16 '15 at 21:40
7
That is not the way you should be changing your path variable. If you are trying to change the PATH variable for the current user only, modify the line in~/.bashrcthat saysexport PATH=$PATH:.... All you need to do is add a colon to the end and include the path. Example:export PATH=$PATH:...:/new/path
â cremefraiche
Apr 16 '15 at 21:44
@cremefraiche thanks let me try that. Btw would you explain why editing the PATh in /etc/environment doesnt work?
â DBS
Apr 16 '15 at 21:46
2
From what I understand it is best not to mess with that file directly, in order to minimize risk of breakage. I should mention that~/.bashrcis run every time an interactive shell is opened, while~/.bash_profileis run when a login shell is opened. Pick which file best suits your needs.
â cremefraiche
Apr 16 '15 at 21:54
 |Â
show 8 more comments
What command did you use to modify your PATH variable?
â cremefraiche
Apr 16 '15 at 21:38
@cremefraiche I used <code> gksudo gedit /etc/environment </code> and then added <code> "/opt/texbin"</code> saved it rebooted but still the same problem.
â DBS
Apr 16 '15 at 21:40
7
That is not the way you should be changing your path variable. If you are trying to change the PATH variable for the current user only, modify the line in~/.bashrcthat saysexport PATH=$PATH:.... All you need to do is add a colon to the end and include the path. Example:export PATH=$PATH:...:/new/path
â cremefraiche
Apr 16 '15 at 21:44
@cremefraiche thanks let me try that. Btw would you explain why editing the PATh in /etc/environment doesnt work?
â DBS
Apr 16 '15 at 21:46
2
From what I understand it is best not to mess with that file directly, in order to minimize risk of breakage. I should mention that~/.bashrcis run every time an interactive shell is opened, while~/.bash_profileis run when a login shell is opened. Pick which file best suits your needs.
â cremefraiche
Apr 16 '15 at 21:54
What command did you use to modify your PATH variable?
â cremefraiche
Apr 16 '15 at 21:38
What command did you use to modify your PATH variable?
â cremefraiche
Apr 16 '15 at 21:38
@cremefraiche I used <code> gksudo gedit /etc/environment </code> and then added <code> "/opt/texbin"</code> saved it rebooted but still the same problem.
â DBS
Apr 16 '15 at 21:40
@cremefraiche I used <code> gksudo gedit /etc/environment </code> and then added <code> "/opt/texbin"</code> saved it rebooted but still the same problem.
â DBS
Apr 16 '15 at 21:40
7
7
That is not the way you should be changing your path variable. If you are trying to change the PATH variable for the current user only, modify the line in
~/.bashrc that says export PATH=$PATH:.... All you need to do is add a colon to the end and include the path. Example: export PATH=$PATH:...:/new/pathâ cremefraiche
Apr 16 '15 at 21:44
That is not the way you should be changing your path variable. If you are trying to change the PATH variable for the current user only, modify the line in
~/.bashrc that says export PATH=$PATH:.... All you need to do is add a colon to the end and include the path. Example: export PATH=$PATH:...:/new/pathâ cremefraiche
Apr 16 '15 at 21:44
@cremefraiche thanks let me try that. Btw would you explain why editing the PATh in /etc/environment doesnt work?
â DBS
Apr 16 '15 at 21:46
@cremefraiche thanks let me try that. Btw would you explain why editing the PATh in /etc/environment doesnt work?
â DBS
Apr 16 '15 at 21:46
2
2
From what I understand it is best not to mess with that file directly, in order to minimize risk of breakage. I should mention that
~/.bashrc is run every time an interactive shell is opened, while ~/.bash_profile is run when a login shell is opened. Pick which file best suits your needs.â cremefraiche
Apr 16 '15 at 21:54
From what I understand it is best not to mess with that file directly, in order to minimize risk of breakage. I should mention that
~/.bashrc is run every time an interactive shell is opened, while ~/.bash_profile is run when a login shell is opened. Pick which file best suits your needs.â cremefraiche
Apr 16 '15 at 21:54
 |Â
show 8 more comments
2 Answers
2
active
oldest
votes
up vote
1
down vote
The correct place to set your PATH is in ~/.bash_profile:
PATH="$PATH:/some/extra/paths:/may/go/here"
The PATH variable should already be exported, so you shouldn't need to export it again (exporting it again has no further effect).
The default path for bash is hardcoded into the bash executable, and then further (possibly) modified in /etc/profile and (on some systems) /etc/bash.bashrc.
My guess is that the path set in /etc/environment is primarily used by non-shells, such as cron etc.
See also:
- How to permanently set environmental variables
add a comment |Â
up vote
1
down vote
Edit
/etc/profileto affect all users.~/.bash_profileto affect single users bash shell (so not this one, as it is for bash specific stuff).~/.profileto affect single user, all shells.
Note: If you have both .profile and .bash_profile and you want both to be read by bash, then you will have to add . .profile to your .bash_profile, as .profile is not read by default, if .bash_profile exists
on sudo
- don't run your editor as root, so don't do
gksudo gedit ëfilenameû - Avoid running X11 apps as root, so don't do
gksudo gedit ëfilenameû - instead do
EDITOR=gedit sudoedit ëfilenameû. It will run the editor as you on a temporary file, it will copy the fill as root when you finish.
@Kusalananda I fixed answer.
â ctrl-alt-delor
Jun 23 at 11:32
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
The correct place to set your PATH is in ~/.bash_profile:
PATH="$PATH:/some/extra/paths:/may/go/here"
The PATH variable should already be exported, so you shouldn't need to export it again (exporting it again has no further effect).
The default path for bash is hardcoded into the bash executable, and then further (possibly) modified in /etc/profile and (on some systems) /etc/bash.bashrc.
My guess is that the path set in /etc/environment is primarily used by non-shells, such as cron etc.
See also:
- How to permanently set environmental variables
add a comment |Â
up vote
1
down vote
The correct place to set your PATH is in ~/.bash_profile:
PATH="$PATH:/some/extra/paths:/may/go/here"
The PATH variable should already be exported, so you shouldn't need to export it again (exporting it again has no further effect).
The default path for bash is hardcoded into the bash executable, and then further (possibly) modified in /etc/profile and (on some systems) /etc/bash.bashrc.
My guess is that the path set in /etc/environment is primarily used by non-shells, such as cron etc.
See also:
- How to permanently set environmental variables
add a comment |Â
up vote
1
down vote
up vote
1
down vote
The correct place to set your PATH is in ~/.bash_profile:
PATH="$PATH:/some/extra/paths:/may/go/here"
The PATH variable should already be exported, so you shouldn't need to export it again (exporting it again has no further effect).
The default path for bash is hardcoded into the bash executable, and then further (possibly) modified in /etc/profile and (on some systems) /etc/bash.bashrc.
My guess is that the path set in /etc/environment is primarily used by non-shells, such as cron etc.
See also:
- How to permanently set environmental variables
The correct place to set your PATH is in ~/.bash_profile:
PATH="$PATH:/some/extra/paths:/may/go/here"
The PATH variable should already be exported, so you shouldn't need to export it again (exporting it again has no further effect).
The default path for bash is hardcoded into the bash executable, and then further (possibly) modified in /etc/profile and (on some systems) /etc/bash.bashrc.
My guess is that the path set in /etc/environment is primarily used by non-shells, such as cron etc.
See also:
- How to permanently set environmental variables
edited Jun 23 at 9:53
answered May 23 '17 at 22:08
Kusalananda
107k14209329
107k14209329
add a comment |Â
add a comment |Â
up vote
1
down vote
Edit
/etc/profileto affect all users.~/.bash_profileto affect single users bash shell (so not this one, as it is for bash specific stuff).~/.profileto affect single user, all shells.
Note: If you have both .profile and .bash_profile and you want both to be read by bash, then you will have to add . .profile to your .bash_profile, as .profile is not read by default, if .bash_profile exists
on sudo
- don't run your editor as root, so don't do
gksudo gedit ëfilenameû - Avoid running X11 apps as root, so don't do
gksudo gedit ëfilenameû - instead do
EDITOR=gedit sudoedit ëfilenameû. It will run the editor as you on a temporary file, it will copy the fill as root when you finish.
@Kusalananda I fixed answer.
â ctrl-alt-delor
Jun 23 at 11:32
add a comment |Â
up vote
1
down vote
Edit
/etc/profileto affect all users.~/.bash_profileto affect single users bash shell (so not this one, as it is for bash specific stuff).~/.profileto affect single user, all shells.
Note: If you have both .profile and .bash_profile and you want both to be read by bash, then you will have to add . .profile to your .bash_profile, as .profile is not read by default, if .bash_profile exists
on sudo
- don't run your editor as root, so don't do
gksudo gedit ëfilenameû - Avoid running X11 apps as root, so don't do
gksudo gedit ëfilenameû - instead do
EDITOR=gedit sudoedit ëfilenameû. It will run the editor as you on a temporary file, it will copy the fill as root when you finish.
@Kusalananda I fixed answer.
â ctrl-alt-delor
Jun 23 at 11:32
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Edit
/etc/profileto affect all users.~/.bash_profileto affect single users bash shell (so not this one, as it is for bash specific stuff).~/.profileto affect single user, all shells.
Note: If you have both .profile and .bash_profile and you want both to be read by bash, then you will have to add . .profile to your .bash_profile, as .profile is not read by default, if .bash_profile exists
on sudo
- don't run your editor as root, so don't do
gksudo gedit ëfilenameû - Avoid running X11 apps as root, so don't do
gksudo gedit ëfilenameû - instead do
EDITOR=gedit sudoedit ëfilenameû. It will run the editor as you on a temporary file, it will copy the fill as root when you finish.
Edit
/etc/profileto affect all users.~/.bash_profileto affect single users bash shell (so not this one, as it is for bash specific stuff).~/.profileto affect single user, all shells.
Note: If you have both .profile and .bash_profile and you want both to be read by bash, then you will have to add . .profile to your .bash_profile, as .profile is not read by default, if .bash_profile exists
on sudo
- don't run your editor as root, so don't do
gksudo gedit ëfilenameû - Avoid running X11 apps as root, so don't do
gksudo gedit ëfilenameû - instead do
EDITOR=gedit sudoedit ëfilenameû. It will run the editor as you on a temporary file, it will copy the fill as root when you finish.
edited Jun 23 at 11:32
answered Jun 23 at 10:36
ctrl-alt-delor
9,20431948
9,20431948
@Kusalananda I fixed answer.
â ctrl-alt-delor
Jun 23 at 11:32
add a comment |Â
@Kusalananda I fixed answer.
â ctrl-alt-delor
Jun 23 at 11:32
@Kusalananda I fixed answer.
â ctrl-alt-delor
Jun 23 at 11:32
@Kusalananda I fixed answer.
â ctrl-alt-delor
Jun 23 at 11:32
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f196702%2ffixing-my-path-variable%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
What command did you use to modify your PATH variable?
â cremefraiche
Apr 16 '15 at 21:38
@cremefraiche I used <code> gksudo gedit /etc/environment </code> and then added <code> "/opt/texbin"</code> saved it rebooted but still the same problem.
â DBS
Apr 16 '15 at 21:40
7
That is not the way you should be changing your path variable. If you are trying to change the PATH variable for the current user only, modify the line in
~/.bashrcthat saysexport PATH=$PATH:.... All you need to do is add a colon to the end and include the path. Example:export PATH=$PATH:...:/new/pathâ cremefraiche
Apr 16 '15 at 21:44
@cremefraiche thanks let me try that. Btw would you explain why editing the PATh in /etc/environment doesnt work?
â DBS
Apr 16 '15 at 21:46
2
From what I understand it is best not to mess with that file directly, in order to minimize risk of breakage. I should mention that
~/.bashrcis run every time an interactive shell is opened, while~/.bash_profileis run when a login shell is opened. Pick which file best suits your needs.â cremefraiche
Apr 16 '15 at 21:54