LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-28-2005, 02:43 PM   #1
alchem
LQ Newbie
 
Registered: Aug 2005
Location: New York
Posts: 12

Rep: Reputation: 0
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
 
Old 08-28-2005, 02:52 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Linux Mint 17, Debian 8
Posts: 7,854

Rep: Reputation: 310Reputation: 310Reputation: 310Reputation: 310
"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
 
Old 08-28-2005, 02:59 PM   #3
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Rep: Reputation: 30
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.
 
Old 08-28-2005, 03:01 PM   #4
alchem
LQ Newbie
 
Registered: Aug 2005
Location: New York
Posts: 12

Original Poster
Rep: Reputation: 0
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
 
Old 08-28-2005, 03:03 PM   #5
alchem
LQ Newbie
 
Registered: Aug 2005
Location: New York
Posts: 12

Original Poster
Rep: Reputation: 0
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...
 
Old 08-28-2005, 03:07 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
/root
 
Old 08-28-2005, 03:12 PM   #7
alchem
LQ Newbie
 
Registered: Aug 2005
Location: New York
Posts: 12

Original Poster
Rep: Reputation: 0
# .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
 
Old 08-28-2005, 03:21 PM   #8
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Rep: Reputation: 30
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.
 
Old 08-28-2005, 03:29 PM   #9
alchem
LQ Newbie
 
Registered: Aug 2005
Location: New York
Posts: 12

Original Poster
Rep: Reputation: 0
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.
 
Old 08-28-2005, 03:41 PM   #10
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Rep: Reputation: 30
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.
 
Old 08-28-2005, 03:50 PM   #11
alchem
LQ Newbie
 
Registered: Aug 2005
Location: New York
Posts: 12

Original Poster
Rep: Reputation: 0
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?
 
Old 08-28-2005, 04:08 PM   #12
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Rep: Reputation: 30
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?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to change the install path? SharpyWarpy Fedora 0 11-24-2005 09:34 AM
How do I change PATH? trotsky Linux - Software 4 12-28-2004 01:08 PM
How do i change the $PATH explorer Fedora 6 10-24-2004 03:21 AM
how do you change your path? zeviddalop Linux - Newbie 3 09-20-2004 04:28 PM
I cannot change my PATH$ variable KptnKrill Linux - Newbie 6 08-17-2003 03:03 PM


All times are GMT -5. The time now is 08:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration