How to run an executable without prepending ./

Solution 1:

You have to run an execitable from current directory as ./executable where . represent the current directory.

If you are in ~/tools/web/visual-studio-code directory to run the executable Code you have to do two things,

  1. Check if the executable has execution permission. See How to make a file executable?
  2. Run the executable as, ./Code Why do I need to type `./` before executing a program in the current directory?

How to run an executable from current directory without ./ before executiable:

Run the following command in a terminal,

echo "export PATH=$PATH:." >> ~/.bashrc

and run Code from ~/tools/web/visual-studio-code as

user@server:~/tools/web/visual-studio-code$ Code 

How to run an executable from any directory without ./ before executiable:

echo "export PATH=$PATH:$HOME/tools/web/visual-studio-code" >> ~/.bashrc

and run Code from anywhere,

user@server:~$ Code