How to run any program from terminal in kali linux?
You can also add all the paths you have your programs in to your PATH environment variable.
Instructions for bash:
Just add to your .bashrc
:
PATH=$PATH:/a/path/here:/another/path/here:/and/so/forth
replacing /a/path/here, /another/path/here, /and/so/forth with your paths. You can add as many paths as you like, but be aware to separate each of the paths with ':' and, don't add spaces between 'PATH' and the '=' sign.
You can also add
PATH=$PATH:.
so that you don't have to type ./program.sh, but only program.sh. Please, note that putting the dot ('.') in front of the path (PATH=$PATH:.
) will prevent you running a program located in another directory if there is an executable file in your current working directory with the same name! So put the dot at the end of the PATH variable, so that if you run in this particular case, you can use the old ./program notation to tell apart which program you want to run.
Hope this helps.
PS: just another note: if you run a graphical program from a terminal emulator window, closing the window will automatically close the graphical interface. In order to avoid that just type myprogram &
(append the ampersand sign '&' to the command you use to run your program). If you forget it, in the terminal window type CTRL+Z
and just after that run the command bg
.