Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
How do I add a new directory to $PATH? If I do "echo $PATH" I get
/sbin:/usr/sbin:/bin:
/usr/bin:/usr/X11R6/bin:/usr/local/bin:
/usr/local/sbinI would like to add /usr/local/apache2 to this path, but don't know how. I searched and searched, but can't find a working solution.
I read that one can add the path to /etc/profile or to /root/.bash_profile, but this doesn't seem to work.
I can open the terminal and type:
PATH="$PATH:/usr/local/apache2", but if I close the terminal, the new entry disappers from the path. So how do I add the directory to the path permanently? after all, /sbin:/usr/sbin:/bin:
/usr/bin:/usr/X11R6/bin:/usr/local/bin:
/usr/local/sbin are permanent, I just don't know where these entries are located, so that I would add the new directory
here are my files:profile:
# /etc/profile -*- Mode: shell-script -*-
# (c) MandrakeSoft, Chmouel Boudjnahloginsh=1
# Users generally won't see annoyng core files
[ "$UID" = "0" ] && ulimit -S -c 1000000 > /dev/null 2>&1if ! echo ${PATH} |grep -q /usr/X11R6/bin ; then
PATH="$PATH:/usr/X11R6/bin"
fiif [ "$UID" -ge 500 ] && ! echo ${PATH} |grep -q /usr/games ; then
export PATH=$PATH:/usr/games
fiumask 022
USER=`id -un`
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
HISTCONTROL=ignoredups
HOSTNAME=`/bin/hostname`
HISTSIZE=1000if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi# some old programs still use it (eg: "man"), and it is also
# required for level1 compliance for LI18NUX2000
NLSPATH=/usr/share/locale/%l/%N
export PATH PS1 USER LOGNAME MAIL HOSTNAME INPUTRC NLSPATH
export HISTCONTROL HISTSIZEfor i in /etc/profile.d/*.sh ; do
if [ -x $i ]; then
. $i
fi
doneunset i
.bash_profile:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
mesg n
PATH="$PATH:/usr/local/apache2/bin"

Either in ~/.bashrc or ~/.bash_profile, add
these two lines,PATH=$PATH:/usr/local/apache2/bin
export PATHLawrence

thanx, it worked. I added the line to .bashrc, logged off/on KDE, and voila-it was part of the $path now.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |