PDA

View Full Version : Wy do i need to use the full path?



mitchell2345
14th February 2007, 09:42 PM
Hi,

I have installed Fedora Core 6 on a few differant systems and they always does this same thing.

Why is it that when i am trying to use a program i have to use the full path.

For example, to restart a service i need to type

/sbin/service name restart
OR using ifconfig, and others

but in many of the guides it just says service which makes me start to believe that i have something wrong.

Thanks,
Mitchell

u-noneinc-s
14th February 2007, 09:46 PM
Because your path is not the same as root path. If you su - (with the dash) it gives you root permission with root environment (so root path) If you do su (no dash) you get root permission with your environment. Since sbin is not in your path you must specify it (or use the dash)

sideways
14th February 2007, 09:47 PM
because fedora's funny about certain stuff, and only wants you to run it with sudo or root login.

You can add /sbin and /usr/sbin to you path in ~/.bash_profile if you like, you still won't be able to execute all the commands, but it's handy for the likes of ifconfig, iwconfig etc

parish
14th February 2007, 10:00 PM
The full path is only necessary if the path to the command is not included in your path variable. Many people include the full path when referring to a command just in case the user's path does not include it, and it doesn't hurt anything.

You can see the contents of your path variable with the command

% echo $path
/usr/local/sbin /usr/sbin /sbin /usr/kerberos/sbin /usr/local/sbin /usr/sbin /sbin /usr/local/sbin /usr/sbin /sbin /usr/lib/qt-3.3/bin /usr/kerberos/bin /usr/local/bin /usr/bin /bin /usr/X11R6/bin

and change it to your liking as suggested by sideways.

Daniel

mitchell2345
14th February 2007, 10:38 PM
Thanks good to know

paul matthijsse
14th February 2007, 11:02 PM
as Mark said, just login as su -, really the easiest way to solve all that...

tinyman
14th February 2007, 11:50 PM
you can type service named restart. This will better