LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 12-05-2005, 06:02 PM   #1
towel401
Member
 
Registered: Apr 2005
Location: Ireland
Distribution: Debian
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

Code:
# 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=$PATH:$1
           else
              PATH=$1:$PATH
           fi
        fi
}

# 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, 06:07 PM   #2
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
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, 10:14 PM   #3
thammerlund
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:

Code:
# .bash_profile

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

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
unset USERNAME
Thank you for your help!
Tom
 
Old 07-23-2006, 10:38 PM   #4
IBall
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:
Code:
PATH=$PATH:$HOME/bin:/usr/java/bin
Then run the command
Code:
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
--Ian
 
  


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:47 PM.

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
Open Source Consulting | Domain Registration