LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Can not find program in terminal (https://www.linuxquestions.org/questions/linux-software-2/can-not-find-program-in-terminal-727526/)

manolakis 05-21-2009 07:48 AM

Can not find program in terminal
 
Hi there,

Does anybody know how can I make an executable to run from terminal? I have a program which when I type its name in the terminal I want the program to be loaded.

Thank you.

acid_kewpie 05-21-2009 08:17 AM

When you run a program in a terminal in searches your $PATH value so if you want a program to run like you say you either need to put it in a location on your path, or change your path to include a new place. Don't be tempted to put your "current" directory on your path though. Bad idea.

colucix 05-21-2009 08:21 AM

You have to add the directory which contains the program to the PATH environment variable. Suppose it is under /home/manolakis/some/program, just do
Code:

export PATH=/home/manolakis/some/program:$PATH
then type the name of the executable, press enter and the trick is done. Take in mind that changes to environment variables are local to the current shell, that is if you open a new terminal you have to export the new PATH again, unless you put the export statement in a file which is sourced whenever a new shell session is open (for example in $HOME/.bashrc). The above command assumes you're using sh/bash as shell. If you use a C-shell (csh/tcsh) the syntax is
Code:

setenv PATH "/home/manolakis/some/program:$PATH"


All times are GMT -5. The time now is 10:26 PM.