LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-16-2009, 03:49 AM   #1
QueenZ
Member
 
Registered: Sep 2008
Distribution: openSUSE, Ubuntu
Posts: 372
Blog Entries: 2

Rep: Reputation: 32
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...
 
Old 02-16-2009, 04:07 AM   #2
thierrys
LQ Newbie
 
Registered: Feb 2009
Distribution: RedHat, Fedora, CentOS
Posts: 27

Rep: Reputation: 18
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
 
Old 02-16-2009, 04:14 AM   #3
QueenZ
Member
 
Registered: Sep 2008
Distribution: openSUSE, Ubuntu
Posts: 372
Blog Entries: 2

Original Poster
Rep: Reputation: 32
in what path?
 
Old 02-16-2009, 04:18 AM   #4
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
$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
 
Old 02-16-2009, 04:34 AM   #5
QueenZ
Member
 
Registered: Sep 2008
Distribution: openSUSE, Ubuntu
Posts: 372
Blog Entries: 2

Original Poster
Rep: Reputation: 32
so how do i make my program to start like Firefox?

queenz@queenz-linux~$ MYPROGRAM

?
 
Old 02-16-2009, 04:42 AM   #6
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
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.
 
Old 02-16-2009, 04:50 AM   #7
thierrys
LQ Newbie
 
Registered: Feb 2009
Distribution: RedHat, Fedora, CentOS
Posts: 27

Rep: Reputation: 18
Have you actually read the links I send you?
 
Old 02-16-2009, 04:58 AM   #8
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
Quote:
Originally Posted by thierrys View Post
Have you actually read the links I send you?
I do not think so. The links are quite useful and give a good information.
 
Old 02-16-2009, 05:07 AM   #9
QueenZ
Member
 
Registered: Sep 2008
Distribution: openSUSE, Ubuntu
Posts: 372
Blog Entries: 2

Original Poster
Rep: Reputation: 32
why are there more than 1 directory?? It's a bit confusing. Which 1 is the best?
 
Old 02-16-2009, 05:14 AM   #10
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,072

Rep: Reputation: 384Reputation: 384Reputation: 384Reputation: 384
Quote:
Originally Posted by QueenZ View Post
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).

Last edited by i92guboj; 02-16-2009 at 05:15 AM.
 
Old 02-16-2009, 05:14 AM   #11
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
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.
 
Old 02-16-2009, 06:07 AM   #12
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.1
Posts: 7,453
Blog Entries: 55

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
app path in c++ linuxmandrake Programming 5 12-30-2007 12:04 PM
Do you add to the path line or make a new path in /etc/profile? M$ISBS Linux - Newbie 2 12-13-2006 02:14 PM
setting path for app n libraries install shizzles Linux - Software 3 07-18-2005 12:26 PM
Installing an App on Linux - wrong path? Rory in Toronto Linux - Newbie 6 03-30-2004 11:15 AM
app.path in linux? mvendramini Programming 10 12-02-2003 01:13 PM


All times are GMT -5. The time now is 09:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration