how to add downloaded programs to path in linux so it can be runable from any directory?


New Member
Hello guys, I have installed manjaro kde in my laptop and the problem i'm facing is, i have downloaded some of kali linux hacking tools from github repo and now i have to run this programs from any directory in terminal. I have added the directory of a singe tool to $PATH and its working fine with that, but i think adding every single directory to $PATH will be a mess. I have also tried taking the script file of that tools which is executable and put them in single directory and then add that directory to path, with this i'm getting [ 'lib not found error' ] and i have also tried symbolic linking and kept those link in /usr/bin/ but i'm getting [ 'lib not found error' ], pls help me guys with this. If you need more info pls let me know.


Well-Known Member
I've written a few different answers on that address this issue.

Personally, I'd set up a personal bin directory in your home directory and copy the programs into there.

See the spoilers in this old post, which includes all of the information you'll need to set up a personal bin directory and add it to $PATH:

Once you have a personal bin directory set up, you can simply add any programs or scripts that you want to run to that directory and because they are in $PATH, you can run them from anywhere in the file-system.

If copying the executables to the personal bin directory causes problems at runtime - e.g. getting errors about libraries not found. But the executables run OK wherever they are originally located, then you have a couple of additional options.

A. Put a symbolic link in your personal bin directory that points to the actual location of the program.
ln -sT /path/to/someProgram/bin/someProgram ~/bin/someProgram
Where /path/to/someProgram/bin/someProgram is the path to the executable file/script you downloaded and ~/bin/someProgram is the path/name of the symbolic link to add to your personal bin directory (which will be at ~/bin/).
That way, your symbolic link in your personal directory will be in $PATH and points directly to the executable you want to run.

Or if using a symbolic link still brings up error messages:
B. Remove the symbolic link and write a 'wrapper' script in your personal bin directory.
#!/usr/bin/env bash

cd /path/to/someProgram/bin/
cd -
Save that in your personal bin directory as someProgram and make it executable using chmod +x ~/bin/someProgram.

That cd's into the directory containing the application (making it the current working directory), then runs the program in the current working directory.
After the program is finished, it cd's back to the original directory it was in before.

Then, when you want to run someProgram (from anywhere in the file-system) your wrapper script will be ran, which will cd into the directory containing the application and will then run it inside that directory.

And again - /path/to/someProgram/bin/ should be the path to the directory containing the executable you want to run.

And ./someProgram is the name of the script/program to run in the above directory.

Also, if the program takes parameters - you could amend the script to pass parameters to the script/program you're running:
#!/usr/bin/env bash

cd /path/to/someProgram/bin/
./someProgram "[email protected]"
cd -
That way you'll be able to pass parameters to your script and your script will pass all of the parameters it receives to the program.

I tend to download a lot of programs and tools as source code and build and install them from source.
Most of the time, they have install scripts, so I will run make install and they will install to somewhere on $PATH.

But sometimes there is no install target in the build system, or perhaps I simply want to run them from my personal bin directory. So I will use one of the strategies above.

Most of the time, simply copying the newly built executable from the source-code to the personal bin directory works.
Although sometimes I do use a symbolic link to the built executable. One advantage of using the symbolic link is that you don't have duplicate files everywhere!
But if you update from git and rebuild the program and it fails, then your symbolic link will be broken - so it's swings and roundabouts with those two options!

In other cases, if the program links to libraries, or other assets that are in the programs source-tree - I'd have to put a wrapper script into my personal bin directory.

So once you have set up a personal bin directory, there are three main ways of getting your custom programs/scripts to run.
Last edited:


Well-Known Member
It might also be a good idea to check the AUR/Arch package repositories for the programs you want. That way, there is no hassle with PATH stuff, and you get easier updating.
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online