Red Hat Linux 7.1: The Official Red Hat Linux Getting Started Guide | ||
---|---|---|
Prev | Chapter 13. Frequently Asked 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 isn't working, try adding ./ before the name of the application's executable.
For example, 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 executable 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 need 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; adding ./ 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 ./ each time. See the following for more information on how to accomplish this.
If you want to periodically start programs without having to enter a ./ before the executable, you'll have to edit a file.
You'll have to add the current working directory (signified by the .) to the list of directories in your PATH environment variable. This will let the shell know that it can start applications in the directory in which you're currently working.
Be Careful With Root Files | |
---|---|
These instructions are intended only for user accounts. Avoid modifying files such as root's .bash_profile, because of the potential security risks. |
Start a text editor, such as pico, at a shell prompt. You can open the file called .bash_profile by typing the following:
pico .bash_profile |
You'll see a PATH statement, similar to the one shown below.
PATH=$PATH:$HOME/bin: |
To the end of this statement, add ./ as shown below
PATH=$PATH:$HOME/bin:/usr/lib/:./ |
Now, type
Now, you should never have to manually add ./ to the beginning of an executable to start an application located in your current working directory.