Skip to main content
1 of 3
rozcietrzewiacz
  • 40.2k
  • 9
  • 98
  • 105

What you are looking for is the PATH environmental variable. It tells the shell, where it needs to look for programs. You can see the current value of that variable using echo:

echo "$PATH"

Now, the best practice if you want use some new program is to install it using the package management program for your distribution. But I assume you mean a program that is not delivered by any package. For that type of programs, you have two options:

  1. Install the program system-wide, in a place where your system does not put any files installed from packages - these can usually be /usr/local/bin/ or /opt/ - those should already be in your PATH. (Look inside those folders and if there are many files in them, then it is the wrong place to put your own program.)
  2. Modify your PATH variable. This is less secure, because it defines additional folders where programs can be kept and someone might play a trick on you, putting his own program there for you to run.

You can do it either temporarily using

    export PATH="$PATH:/path/to/your/executable"

(mind the $PATH after =), or permanently by adding the above line to your .bashrc file (assuming you use bash).

rozcietrzewiacz
  • 40.2k
  • 9
  • 98
  • 105