Red Hat Linux 6.2: The Official Red Hat Linux Getting Started Guide | ||
---|---|---|
Prev | Chapter 15. Q & A: Quick Answers to Common Questions | Next |
I installed an application I downloaded, and everything seemed to go fine, but I still get "command not found" when I type its name. I think I have the right name, so why won't it start?
If you're trying to start an application from the shell prompt and it's proving fruitless, try preceding the name of the application's executable with a ./.
Let's say you've downloaded a setiathome client and want to try it out. You follow the directions for installing the software. Now you change to the directory in which you know the exeutable can be found (as shown below).
cd setiathome |
To start the application now, precede the executable with a "./," as shown below:
./setiathome |
Briefly, the reason you've got to use the ./ in order to start the application is because the executable wasn't placed in a directory where your shell knew it could be found (such as /usr/bin).
In such instances, you often have to go into the directory which holds the executable and start the application from there. That means you'll have to tell your shell where it can find the executable -- stating ./ tells bash the executable can be found in the "current working directory."
You can customize your settings so that you won't be required to use the ./, however. See the following for more info on how to accomplish this.
If you want to periodically start programs without having to enter a ./ before the executable, you'll have to do a little tweaking.
Basically, you'll have to add the "current working directory" (.) to your the list of directories in your PATH environment variable, letting the shell know that it can start applications in whichever directory you're currently working.
![]() | These instructions are intended only for user accounts. Avoid modifying files such as .bash_profile for root, because of the potential security risks. |
Using a text editor, such as pico, in an Xterm window, open the file called .bash_profile by typing
pico .bash_profile |
You'll see a PATH statement, similar to the one shown below.
PATH=$PATH:$HOME/bin:/usr/lib/ |
Now, to the end of this statement, add :./, as shown below
PATH=$PATH:$HOME/bin:/usr/lib/:./ |
Now, type Ctrl-X; you'll be asked whether you want to save "the modified buffer"; type Y for "yes." Next, you'll see the name the file will be saved as; press the Enter key.
You're done. Now, you won't be required to start some applications with the ./ preceding the name of the executable.