[Techtalk] Linux PATH question

aec brat at magma.ca
Fri Oct 1 16:28:21 EST 2004


On Fri, Oct 01, 2004 at 11:35:00AM -0500, ed orphan wrote:
> I know how to view the Linux PATH; echo $PATH
> and how to add more to it using export,
> but how do you remove a path from PATH?
> Suppose you wanted to remover a directory surrounded by other
> directories, like /usr/bin in the PATH below:
>  /home/ourhome:/usr/bin:/lib:/usr/local/bin
> I used to be able to edit the PATH directly from .bash_profile
> but I can't even find where the PATH is stored in Red Hat.
> Yet another "improvement" I don't comprehend.
> 
> _______________________________________________
> Techtalk mailing list
> Techtalk at linuxchix.org
> http://mailman.linuxchix.org/mailman/listinfo/techtalk
> 

Here is my path,


/home/orchid/bin:/usr/local/j2re1.4.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games

if I wanted to remove /usr/local/j2re1.4.1/bin I could simply type :

export PATH=/home/orchid/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games

as for Redhat storing environment variables like $PATH, do you have a
~/.bashrc, you mentioned ~/.bash_profile, what currently is in this? I
am pretty sure that you can simple place your PATH statement in there
if Redhat has neglected to do so. 

I use debian, but this should work for any system that uses bash.

in my ~/.bash_profile:

# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# set PATH so it includes user's private bin if it exists
if [ -d ~/bin ] ; then
    PATH=~/bin:"${PATH}"
fi

This tells it to read my .bashrc, so, inside my
~/.bashrc i place:


#editor
export EDITOR=vim
#term
export TERM=rxvt
#browser
export BROWSER=firefox
# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=erasedups
export HISTSIZE=5000
#export HISTIGNORE=ignoredups

#find a file with a string in its name: ff
function ff() { find . -type f -iname '*'$*'*' -ls ; }

export PATH=/home/orchid/bin:/usr/local/j2re1.4.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games

# Some more alias to avoid making mistakes:
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
#gcc
alias gcc='gcc -Wall -v'
#apt-get install dict dictd dict-moby-thesaurus
alias thes='dict -d moby-thesaurus'

So, all of my personal settings go into .bashrc . If these files are not created already
 by Redhat, go ahead and do so, log out, back in and see if it works. 

Debian has examples in /etc/skel/.bashrc and /etc/skel.bash_profile , look and see if you have 
those in Redhat and maybe take a look in /usr/share/doc/bash



-- 
Angelina Carlton


More information about the Techtalk mailing list