Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 12-05-2005, 07:02 PM   #1
Registered: Apr 2005
Location: Ireland
Distribution: Mepis, mdk10
Posts: 39

Rep: Reputation: 15
add to path

for some reason /sbin and /usr/sbin arent in the path.. when i looked for a way to add them their config files seemed a completely different format

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

pathmunge () {
        if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
           if [ "$2" = "after" ] ; then

# Path manipulation
if [ $EUID = 0 ]; then
        pathmunge /sbin
        pathmunge /usr/sbin
        pathmunge /usr/local/sbin
it only lists the paths that arnt listed, can i just get rid of the /sbin and /usr/sbin lines and it will work? why are they not in there by default anyway, on mepis they were why not on fc4?
Old 12-05-2005, 07:07 PM   #2
LQ Guru
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 75
For security reasons /sbin and related directories are usually only in roots path. You can add them to your path by adding them to the PATH section in your ~/.bash_profile.
Old 07-23-2006, 11:14 PM   #3
LQ Newbie
Registered: Jul 2006
Posts: 22

Rep: Reputation: 15
I want to add the PATH to my new installation of java I just installed. (I used Sun's installation instructions)

I found that I need to add it to the PATH section in my ~/.bash_profile. I have 2 questions about this.

1) If I add it to root's .bash_profile, will it go to everyone's? Or do I have to edit each user's PATH?

2) How do I edit the .bash_profile file? Mine looks like:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc

# User specific environment and startup programs


export PATH
Thank you for your help!
Old 07-23-2006, 11:38 PM   #4
Senior Member
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
1. If you change root's .bash_profile, it will only apply to root. If you want to make system-wide changes, then edit /etc/profile (as root).

2. Open ~/.bash_profile in your favourite text editor. I will assume that you installed Java to /usr/java (subsitute for wherever you actually installed it) Change the line PATH=... to look like:
Then run the command
source ~/.bash_profile
to apply the changes to your current shell.

Run "java --version" to check that it is installed correctly.

I hope this helps


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
Add path to @INC deus1 Linux - Software 0 07-27-2005 08:52 AM
add dirs to $PATH zchoyt Linux - General 4 09-13-2004 03:00 PM
How to add subdirectories in PATH marconi Linux - General 3 08-27-2004 04:27 PM
add man path alaios Linux - General 2 03-14-2004 10:45 PM
How do I add something to my $PATH? iammeuno Linux - Software 1 12-18-2003 05:02 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:05 PM.

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