Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

New to Linux



Jerry Feldman wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Wed, 1 Oct 2003 12:33:41 -0400 (EDT)
> "Timothy M. Lyons" <lyons at digitalvoodoo.org> wrote:
> 
> > Alaric,
> >
> > Are you using 'su' or 'su -'?
> >
> > 'su -' makes the shell a login shell and provides all the necessary
> > environment modifications (path/custom variables) available to you.
> >
> > Without the hyphen, you maintain the current user environment.
> >
> > --Tim
> >
> >
> > Alaric said:
> > > at it, and it told me "file not found" this was done as a SU. I'm
> > > feeling
> > >
> As a regular user, /sbin and /usr/sbin are not in your path. chkconfig
> is in the /sbin directory.
> 
So just to combine and amplify on the previous responses, if you got to
superuser by typing just "su", your new shell inherits your previous
$PATH, which does not contain /sbin and /usr/sbin, and it won't
find executables in those directories. If you typed "su -", the new
shell picks up the root account's $PATH variable, and will find
those executables, because root's $PATH includes /sbin and /usr/sbin.

 As a matter of common UNIX practice, the current directory is not
included in $PATH. $PATH, just to spell it out explicitly, is the
list of directories that the shell searches for executable files -
if your $PATH contains, say, /usr/bin:/usr/local/bin:/bin:/usr/X11R6/bin ,
then when you type "foo" the shell will search the $PATH directories
in the listed order until it finds an executable file named "foo" to run.
Because the current directory (the directory named ".") is not part of
the $PATH list, you can't run /sbin/chkconfig by going to the /sbin
directory (cd /sbin) and typing "chkconfig". If you want to run something
in the current directory, you need to specify the pathname explicitly, as
"./foo". So "cd /sbin; ./chkconfig" would work.

John




BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org