Results 1 to 10 of 17
Hi folks,
BLFS 6.1
On running following command
# echo $PATH
Code:
/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.
Which file shall I edit to change it as;
/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin
Please advise. TIA
BR
satimis...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-14-2005 #1Linux Guru
- Join Date
- Sep 2004
- Posts
- 1,712
A question on PATH
Hi folks,
BLFS 6.1
On running following command
# echo $PATHWhich file shall I edit to change it as;Code:/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.
/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin
Please advise. TIA
BR
satimis
- 09-14-2005 #2
To set PATH var you may want to add the following line to your .bashrc file in your home directory (or to /root directory if you want this PATH to be available to all users)
Code:export PATH=$PATH:/add/your/path
- 09-14-2005 #3Linux Guru
- Join Date
- Sep 2004
- Posts
- 1,712
Hi RustamB,
Tks for your advice. However I can't understand follows;
1)
On FC3 Host
# echo $PATH# cat /root/.bash_profileCode:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/satimis/bin
How can "PATH=$PATH:$HOME/bin" showed "/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/satimis/bin" on running "echo $PATH"?Code:# .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH unset USERNAME
2)
BLFS 6.1
# echo $PATH# cat /mnt/lfs/root/.bash_profileCode:/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.
The path is not showed there. How "echo $PATH" displayed "/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:." ?Code:<snip> append () { # First remove the directory local IFS=':' local NEWPATH for DIR in $PATH; do if [ "$DIR" != "$1" ]; then NEWPATH=${NEWPATH:+$NEWPATH:}$DIR fi done # Then append the directory export PATH=$NEWPATH:$1 } if [ -f "$HOME/.bashrc" ] ; then source $HOME/.bashrc fi if [ -d "$HOME/bin" ] ; then append $HOME/bin fi unset append # End ~/.bash_profile
Please advise. TIA
BR
satimis
- 09-14-2005 #4Linux Guru
- Join Date
- Sep 2004
- Posts
- 1,712
Originally Posted by satimis
- 09-14-2005 #5PATH is also set somewhere else, but I'm not sure where and why.The path is not showed there. How can "echo $PATH" display "/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:." ?
When you do the followingyou ADD /your/path to existing PATH variable. If you want to entirely replace it with your PATH variable then runCode:export PATH=$PATH:/your/path
Code:export PATH=/your/path
- 09-15-2005 #6Linux Guru
- Join Date
- Sep 2004
- Posts
- 1,712
Hi RustamB,
Tks for your advice.
There are 3 different paths;
1)
As User
bash-3.00$ echo $PATH2)Code:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin
As "su"
bash-3.00$ su
Password:
root@localhost:/home/satimis# echo $PATH3)Code:/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.
As "su -"
Password:
root@localhost:~# echo $PATHWhich of them is the correct path? TIACode:/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin
BR
satimis
- 09-15-2005 #7
There is no such a thing as correct path. The correct is the one, when all your programs work fine. So I can't say which one is correct for your
If you are not sure what to include in your PATH, use as much values as you can
Unused paths will not do any harm, so I would reccommend you just add you desired path values to existing PATH. Like this: add this line in /yourhomedir/.bashrc file or in /root/.bashrc.Code:export PATH=$PATH:/qqq/www/eee
- 09-15-2005 #8Linux Guru
- Join Date
- Sep 2004
- Posts
- 1,712
Hi RustamB
root@localhost:/home/satimis# cat /home/satimis/.bashrcadd this line in /yourhomedir/.bashrc file or in /root/.bashrc.Code:export PATH=$PATH:/qqq/www/eee
root@localhost:/home/satimis# locate bashrcCode:cat: /home/satimis/.bashrc: No such file or directory
/home/satimis/./bashrc seems not existing. But bash-3.00$ echo $PATHCode:/root/.bashrc
has output.Code:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin
What shall i do, creating a new empty file? OR copy /root/.bashrc to there?
root@localhost:/home/satimis# cat /root/.bashrcShall I add the line immediately above "End ~/.bashrc"Code:# Begin ~/.bashrc # Written for Beyond Linux From Scratch # by James Robertson <jameswrobertson@earthlink.net> # Personal aliases and functions. # Personal environment variables and startup programs should go in # ~/.bash_profile. System wide environment variables and startup # programs are in /etc/profile. System wide aliases and functions are # in /etc/bashrc. if [ -f "/etc/bashrc" ] ; then source /etc/bashrc fi # End ~/.bashrc
BR
satimis
- 09-15-2005 #9
Create new file ".bashrc" in your home dir and add that command line there.
- 09-15-2005 #10Linux Guru
- Join Date
- Sep 2004
- Posts
- 1,712
So the file contains only one line?
Originally Posted by RustamB
Tks
BR
satimis


Reply With Quote
