LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Run from root and from folder (https://www.linuxquestions.org/questions/linux-newbie-8/run-from-root-and-from-folder-555671/)

ASTRAPI 05-21-2007 07:06 PM

Run from root and from folder
 
Hi

1)I need some info why some prgs run straight from root and some others need to browse to the folder and then run?

2)How can i select where to install and from where to run?

I use the following commands:

./configure
make
make install


Thanks

Okie 05-21-2007 07:18 PM

if you compiled source code and it installed and you did not set any parameters to ./configure they most likely installed to /usr/local, you might be able run them from /usr/local...

usually people use the parameter --prefix=/usr when running ./configure so they go in to /usr and not /usr/local...

your learning something today...

next time run ./configure --help and you will get some information that will help you along when you compile source code...

Wim Sturkenboom 05-21-2007 11:00 PM

Do not exactly understand question 1, but the following may help:

Your system is setup to look in certain directories when you enter a command. If the command is not in those directories, you have to specify the path in front of the command or navigate to the directory and run the command from there.
Where the system looks is defined by the variable $PATH. Below are two examples, one for a normal user and one for root.
Code:

wim@btd-techweb01:~$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/opt/www/htdig/bin:/usr/lib/java/bin:/usr/lib/java/jre/bin:/usr/share/texmf/bin:.
wim@btd-techweb01:~$ ifconfig
-bash: ifconfig: command not found
wim@btd-techweb01:~$ /sbin/ifconfig
eth0      Link encap:Ethernet  HWaddr 00:07:E9:3C:D0:4C
          inet addr:172.31.212.190  Bcast:172.31.213.255  Mask:255.255.254.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8234287 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1436852 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:710886591 (677.9 Mb)  TX bytes:1034567591 (986.6 Mb)
          Interrupt:11 Base address:0xc000

eth0:1    Link encap:Ethernet  HWaddr 00:07:E9:3C:D0:4C
          inet addr:172.31.212.191  Bcast:172.31.213.255  Mask:255.255.254.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:11 Base address:0xc000

eth0:2    Link encap:Ethernet  HWaddr 00:07:E9:3C:D0:4C
          inet addr:172.31.212.192  Bcast:172.31.213.255  Mask:255.255.254.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:11 Base address:0xc000

eth0:3    Link encap:Ethernet  HWaddr 00:07:E9:3C:D0:4C
          inet addr:172.31.212.193  Bcast:172.31.213.255  Mask:255.255.254.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:11 Base address:0xc000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:9 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:756 (756.0 b)  TX bytes:756 (756.0 b)

wim@btd-techweb01:~$

Please note the dot at the end of the PATH. This indicates the current dircetory and allows to directly run from a directory. On other systems, it is not there and you have to use ./myprogram to run myprogram.
Code:

root@btd-techweb01:~# echo $PATH
/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/opt/www/htdig/bin:/usr/lib/java/bin:/usr/lib/java/jre/bin:/usr/share/texmf/bin
root@btd-techweb01:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:07:E9:3C:D0:4C
          inet addr:172.31.212.190  Bcast:172.31.213.255  Mask:255.255.254.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8234396 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1436964 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:710896857 (677.9 Mb)  TX bytes:1034578163 (986.6 Mb)
          Interrupt:11 Base address:0xc000

eth0:1    Link encap:Ethernet  HWaddr 00:07:E9:3C:D0:4C
          inet addr:172.31.212.191  Bcast:172.31.213.255  Mask:255.255.254.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:11 Base address:0xc000

eth0:2    Link encap:Ethernet  HWaddr 00:07:E9:3C:D0:4C
          inet addr:172.31.212.192  Bcast:172.31.213.255  Mask:255.255.254.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:11 Base address:0xc000

eth0:3    Link encap:Ethernet  HWaddr 00:07:E9:3C:D0:4C
          inet addr:172.31.212.193  Bcast:172.31.213.255  Mask:255.255.254.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:11 Base address:0xc000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:9 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:756 (756.0 b)  TX bytes:756 (756.0 b)

root@btd-techweb01:~#

Please note that the current directory is not used in the PATH of the root user. Reason is that a user might have a dangerous command with the same name as a 'normal' command (e.g. ls to delete files). If the root user issues that command while in the user's directory, he might delete the whole system.

ASTRAPI 05-22-2007 05:53 PM

I will read more about linux basics.

Thank you.


All times are GMT -5. The time now is 11:11 AM.