Click to See Complete Forum and Search --> : bash: *****: command not found
Wibble
04-21-2005, 08:45 AM
I'm trying to run some stuff from the command line, and whenever I enter the command, for example chkconfig, this is what happens:
#chkconfig swat on
#bash: chkconfig; command not found
So, I did a locate chkconfig, and it found a lot of instances of it, one in the sbin directory. I navigated to that directory, tried to run the same command, but got the same error.
It also happens when I try to use the shutdown command.
Both times I was root user.
I'm running RH9.
mrBen
04-21-2005, 09:48 AM
OK - a few things:
1. Linux does not have the current directory in its $PATH, thus navigating to a directory and trying to run a command will not work. You will need to either specify a full path (eg /sbin/chkconfig) or the directory itself (eg ./chkconfig when in the sbin directory)
2. If you login in as a user and then use the su command, you become the root user but you retain the users $PATH. Thus /sbin is unlikely to be available. You will need to run su - to get roots $PATH.
palinux
04-21-2005, 12:57 PM
The $PATH environment variable defines the search path for commands. To see what it is set to, as root enter the following commands and kindly post the output:
echo $PATH
chkconfig --list smb
soulestream
04-21-2005, 03:54 PM
also this may be a linux thing, but I know its a redhat thing and is annoying.
user has PATH 1
root has PATH 2
if you are user with PATH 1 and
su to root you still have PATH 1
if you su -l
to root then you have roots path
soule
In all the distros it's the same thing. Iin most of the distros there's a unique PATH set depending whether the user is root or a normal user.
justlinux.com
Copyright 2007 Jupitermedia Corporation All Rights Reserved.