LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   keep change in PATH (https://www.linuxquestions.org/questions/linux-newbie-8/keep-change-in-path-357848/)

alchem 08-28-2005 02:43 PM

keep change in PATH
 
I've found it necessary to export /usr/sbin to my shell using the command 'export path=$PATH:/usr/sbin'. It works for a day or so then i have to give the command again....why? how to fix:o

jailbait 08-28-2005 02:52 PM

"I've found it necessary to export /usr/sbin to my shell using the command 'export path=$PATH:/usr/sbin'. It works for a day or so then i have to give the command again....why? how to fix"

Whenever you logout or reboot the PATH variable is set back to the original value. You can make your export command permanent by placing it in /home/user/.bashrc on most distributions.

----------------------
Steve Stites

jrdioko 08-28-2005 02:59 PM

That's the way you do it, but why do you need to put /usr/sbin in your PATH? The way I understand it, that's usually just for programs that normally need root permissions, and root's PATH should include it.

alchem 08-28-2005 03:01 PM

Quote:

Originally posted by jailbait
"I've found it necessary to export /usr/sbin to my shell using the command 'export path=$PATH:/usr/sbin'. It works for a day or so then i have to give the command again....why? how to fix"

Whenever you logout or reboot the PATH variable is set back to the original value. You can make your export command permanent by placing it in /home/user/.bashrc on most distributions.

----------------------
Steve Stites

I'm using rh9 and am trying to set this path as root. there doesnt seem to be a root in /home/username...so where is the equivalent of /home/user/.bashrc for the root?

Thanks

alchem 08-28-2005 03:03 PM

jrdioko,
performing routine sys admin, i find i need it to run things like ifconfig, ...
I found that without this addition I cant run these pgms...

Tinkster 08-28-2005 03:07 PM

/root

alchem 08-28-2005 03:12 PM

# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi


would i add it where i did below?


# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc, /usr/sbin
fi

thanks again

jrdioko 08-28-2005 03:21 PM

Add it wherever you want, just stick it on the top or bottom. I'm pretty surprised that /usr/sbin isn't in root's PATH, though. How are you becoming root? Try going to a console, typing "su -" to become root (the "-" is required to inherit all the things in root's .bashrc), and seeing what "echo $PATH" gives you.

alchem 08-28-2005 03:29 PM

Here is the display

[root@localhost root]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin

and i added here:

# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc,/usr/sbin
fi
I hope a comma separated list is the correct syntax.

jrdioko 08-28-2005 03:41 PM

Well ok, not anywhere. That section is for something entirely different. Pick a new line, outside of any existing section, and put:

Code:

export PATH=$PATH:/usr/sbin
but... the echo $PATH output shows it's already in your PATH so you shouldn't have to do it at all.

alchem 08-28-2005 03:50 PM

jrdioko,

i added the line after the fi. It shows in the path now b/c I haven't rebooted, but, rest assured, when i do it will be gone. I can check it tomorrow, for, when i reboot i have to manually load the driver fot eth0 by typing:

/sbin/insmod e100 where e100 is the name of the driver. I'd like to get this to run automatically as well.
Any ideas?

jrdioko 08-28-2005 04:08 PM

Unless you have a reason not to, you probably want to use modprobe instead of insmod to load modules. On my system, those lines go in /etc/rc.d/rc.modules.

Are you using "su -" instead of "su" to become root and /usr/sbin still isn't showing up in your path?


All times are GMT -5. The time now is 06:52 AM.