-   Linux - Newbie (
-   -   I have a stoopid noob question!! (

sharvey44 04-06-2005 10:37 AM

I have a stoopid noob question!!
What's the difference between running a program with the prefix ./


$ ./program <arguement>

$ program <arguement>

I know its stupid one but i cant find the answer anywhere!!


phil.d.g 04-06-2005 10:39 AM

the ./ represents your working directory. As a normal user you normally have ./ in your path so don't need to bother with it, but when your root you don't, so you need the ./ to execute a script or program in the current directory

merchtemeagle 04-06-2005 10:41 AM


$ ./program <arguement>
This searches the current directory.


$ program <arguement
This searches the $PATH.

rose_bud4201 04-06-2005 12:13 PM

Continuing on what merchtemeagle said, $PATH contains a colon-separated list of all the directories linux by default looks in when you type the name of an executable.

You can find out if "." (i.e. whatever directory you're currently in) is in your $PATH by doing

echo $PATH

[lthurber@hostname ~]$ echo $PATH

If you look closely you can see that I do in fact have . in my path - right there between /opt/kde3/bin and /opt/IBM/director/bin :)

If it is there (as it usually will be, for a regular user) you won't have to type the ./ to run a program in your current directory.

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