I created an executable file using gcc and put it into the ~/scode folder. How do I run it? I tried typing just the name of the file but it responded with

Command not found.

I believe there is a defined path the system uses to find executable but don't know how to find out what paths there are. The executable file has the attributes rwxrwxr-x.


To run the executable (or script) from within ~/scode:

$ ./executableFileName

Or create a directory named ~/bin and copy the executable (or script) to the directory:

$ mkdir ~/bin
$ cp path_to_your_executable ~/bin

Now you can directly call executable (script) with the name:

$ executableFileName

(To call the executable (or script) with sudo or to make it available to other users as well, copy to /bin or /usr/bin instead.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.