Ubuntu: Permission denied in ubuntu without ./ [closed]


I've a big problem running programs in programming languages which need ./ to be executed (C, C++, Pascal and others) and I've really tried everything to solve it, including changing permissions on the files. This problem arose seven months ago.

I can't really explain why and how it appeared out of the blue: the day before I could run the programs, the next day no. I've no problems running programs in languages which don't need ./. I've asked some friends of mine who study computer science but neither them have found the problem.


It's not a permissions issue, but a path issue.

The ./ is required because it specifies the path of the file you intend to execute (or edit, touch, whatever).

If you don't specify a path (for instance, running a program like vim), the shell will look at your $PATH variable (which is a list of folders) and look in each one until it either finds a file that matches or exhausts the list without finding one.

Some users like to add . to their $PATH so that they can always interact with files in whatever directory they're in. It may be the case that . used to be in your $PATH and was somehow removed.

There's more information and a complete answer regarding adding a directory (including .) to your $PATH at How to add a directory to the PATH?

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »