LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How can i make app to run without path like Firefox and others? (https://www.linuxquestions.org/questions/linux-newbie-8/how-can-i-make-app-to-run-without-path-like-firefox-and-others-704984/)

QueenZ 02-16-2009 03:49 AM

How can i make app to run without path like Firefox and others?
 
OK, when i open up terminal and i type "Firefox" it opens it but i didn't specify any path. There has to be some dir it's inside like /bin or something.. i don't know how it's possible...

thierrys 02-16-2009 04:07 AM

This is because the binary file for firefox is in the path.
if you type echo $PATH at the command line it will tell you which directories are part of your path
Read the links below, that should get you started

[1]http://en.wikipedia.org/wiki/Path_(variable)
[2]http://www.troubleshooters.com/linux/prepostpath.htm should help you understand how it works

hth
Thierry

QueenZ 02-16-2009 04:14 AM

in what path?

linuxlover.chaitanya 02-16-2009 04:18 AM

$PATH is an environment variable that your system uses to find the binaries or executables if you do not specify explicitly. It will look into only those locations listed in PATH variable.
Do
Code:

echo $PATH
And you will get something like this

Code:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

QueenZ 02-16-2009 04:34 AM

so how do i make my program to start like Firefox?

queenz@queenz-linux~$ MYPROGRAM

?

colucix 02-16-2009 04:42 AM

Just put your program somwhere in your PATH. Usually many distributions include the directory $HOME/bin in the user's PATH, so you can just create (if missing) the directory $HOME/bin and put your executables there. First verify that $HOME/bin is in your PATH, otherwise you can add it. If in doubt post the output of the command:
Code:

echo $PATH
so that we can take a look at your current PATH settings.

thierrys 02-16-2009 04:50 AM

Have you actually read the links I send you?

linuxlover.chaitanya 02-16-2009 04:58 AM

Quote:

Originally Posted by thierrys (Post 3445255)
Have you actually read the links I send you?

I do not think so. The links are quite useful and give a good information.

QueenZ 02-16-2009 05:07 AM

why are there more than 1 directory?? It's a bit confusing. Which 1 is the best?

i92guboj 02-16-2009 05:14 AM

Quote:

Originally Posted by QueenZ (Post 3445276)
why are there more than 1 directory?? It's a bit confusing. Which 1 is the best?

Because binaries can live in many directories. You can put your programs in either of these dirs or add a directory to the $PATH, read the info given above in that links to know how.

There's no "best" directory, though the convention is to either add a new directory or to put your programs in /usr/local/bin, so they won't get overwritten by your package manager in the future or something. Note also that the directories will be looked up in the same order they are set in your $PATH, that means that the first binary found with a given name will be used, so the ordering of the $PATH, and whether you append or pre-pend a new path is very important.

This is nothing new by the way, DOS already used a similar mechanism, with the difference that in DOS, the current dir (.) was included in your $PATH by default, but in Linux it isn't (security flaw).

linuxlover.chaitanya 02-16-2009 05:14 AM

Have you gone through the links? They give you the information needed? There is no best. You can put the excutable anywhere you want and put that directory in your PATH variable and you will be able to use it like you said you want to. But by default the path variable has the locations that I already mentioned. These are the locations where by default the applications or the excutables are placed or applications are installed here by default.

brianL 02-16-2009 06:07 AM

Read this:
http://tldp.org/LDP/Linux-Filesystem...tml/index.html


All times are GMT -5. The time now is 05:24 PM.