BasH: Command Not Found

It is not part of the path

echo $PATH

to run a program in your working directory run:



Since you’re running an executable in the current working directory, you should prefix it with ./. So for your program run it as ./a.out

The terminal searches for executables in $PATH. This is a Unix environment variable that lists directories containing system binaries (such as ls, echo, or gcc). If you call an executable that’s not in a $PATH directory (such as a.out), you need to indicate its absolute path in the file system.

In the terminal . is a synonym for the current working directory, thus ./a.out You could equally well call /home/yihang/Documents/a.out

Taken from Askubuntu