Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Directories to my Path 3

Status
Not open for further replies.

Halfcan

Technical User
Dec 8, 2002
214
US
OK, RedHat 7.3, Bash shell.

I want to add /usr/sbin to my path so that I can run common commands from any directory.

I ran this command to add this path:
export path=$path:/usr/sbin

But I still can't run common commands like useradd, or traceroute...I get:

bash: useradd: command not found

My path now looks like this:

echo $path
:/usr/sbin:/usr/sbin:/usr/sbin:/usr/local/sbin:/usr/bin:.

(note the extra /usr/sbin entries)

What I am I doing wrong? please help.

Thanks,
HC



I
 
Have you tried this more than once? Remember, linux will do what you tell it, not what you want. remove the extra path statements and make sure you have rights to useradd.
 
franklin, thanks for responding,

I figured out what I did wrong.

CAPS.

I was entering export path=$path:/usr/sbin
instead of
export PATH=$PATH:/usr/sbin

You wouldn't happen to know how I can clean up my extra /usr/sbin entries would you?

Thanks,
HC
 
source your original environment setup file (~/.bashrc, ~/.bash_profile, ~/.environment, whatever) and you should get your original $PATH back. or maybe just 'export PATH='/yadda/yadda:yadda' (just don't put the existing $PATH variable in there).

----
JBR
 
Mmmkay, Any idea, why export PATH=$PATH:/usr/sbin doesn't sick?
When I log off the machine, and log back on, I have to issue this command again.
?
 
put the 'export PATH...' stuff into your ~/.bashrc or ~/.bash_profile (not sure which is the 'right' one). it will be sourced at every login.

----
JBR
 
I added export PATH=$PATH:/usr/sbin to ~/.bash_profile and it now works. Thank you!
HC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top