LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices

Reply
 
Search this Thread
Old 07-05-2012, 05:08 AM   #1
AlexFr
LQ Newbie
 
Registered: May 2010
Posts: 24

Rep: Reputation: 0
How to add /sbin to the system path


I want to run any file from /sbin, /usr/sbin, /usr/local/sbin without specifying full path. Currently executables from these directories are not included. How can I do this?
 
Old 07-05-2012, 05:18 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
I would have thought that at least /sbin would be included by default..??? What does "echo $PATH" show?

regardless, to add a directory to PATH:
Code:
export PATH="$PATH:<item1>:<item2>..etc"
eg, to add /bin:
export PATH="$PATH:/sbin"
 
2 members found this post helpful.
Old 07-05-2012, 05:25 AM   #3
AlexFr
LQ Newbie
 
Registered: May 2010
Posts: 24

Original Poster
Rep: Reputation: 0
Code:
[alex@localhost ~]$ echo $PATH
/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/alex/bin
So, required shell commands should be:
Code:
export PATH="$PATH:/sbin:/usr/sbin:usr/local/sbin"
Is this correct?
How to make this change persistent? In Ubuntu, I can add script file to /etc/profile.d directory, and it is executed every time OS starts. Can I do this in RHEL?
 
Old 07-05-2012, 05:38 AM   #4
AlexFr
LQ Newbie
 
Registered: May 2010
Posts: 24

Original Poster
Rep: Reputation: 0
OK, works exactly as I expected. Thanks.
 
Old 07-05-2012, 06:41 AM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,618

Rep: Reputation: 2525Reputation: 2525Reputation: 2525Reputation: 2525Reputation: 2525Reputation: 2525Reputation: 2525Reputation: 2525Reputation: 2525Reputation: 2525Reputation: 2525
RHEL : When you do : su
.. then /sbin/ and /usr/sbin/ will not be in the PATH.

Solution : su - ( su <space> <hyphen> )
 
  


Reply

Tags
path


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
/sbin path jstephens84 Fedora 3 11-16-2005 12:14 AM
/sbin path mickeyboa Fedora 7 11-13-2005 12:32 PM
Want2use /sbin cmds undr non-root account w/o sudo. Is it safe 2 add /sbin 2 my PATH? kornerr Linux - General 4 02-25-2005 09:29 AM
$PATH for root to /sbin mickeyboa Fedora 6 01-15-2005 11:07 AM
As root, not seeing /sbin and /usr/sbin in path weghman Linux - Newbie 3 04-25-2004 01:06 PM


All times are GMT -5. The time now is 04:30 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration