I tried executing a script with this command:


but it doesn't work:

No such file or directory

Any ideas?

  • 4
    Obviously there isn't such a file or directory. So you give wrong path. The dot there doesn't mean "execute". It's just part of the path. In shell you normally type either files to be executed or commands(which in fact are also files) :)
    – Pithikos
    Nov 2, 2011 at 14:52
  • get rid of that starting period and try again. Alternatively, ~/scripts/someScript will also work. also keep `` qoutes in mind, and the exec programs ($man exec)
    – j0h
    Apr 26, 2014 at 2:37

4 Answers 4


The leading dot in your command means "relative to the current directory". Remove it and it'll refer to "the file someScript in the directory /home/user/scripts:


If you get "Permission denied", it's either because you do not have sufficient permissions to access the file in the directory of other users or because the file is not executable. To make it executable, run:

chmod +x /home/user/scripts/someScript

If your script needs to access resources in the same folder that it is being run from, and you have it specified as relative paths, then your script will break.

I always add a cd $(dirname $0) to the head of my script so the folder containing the script will be the root folder.


Remove the .

If you make the scrip executable with chmod 755 <nameofscript> to run it you only need to type the path to the script.

When you see ./script being used it telling the shell that the script is located on the same directory you are executing it. To use full path you type sh /home/user/scripts/someScript.

  • sh /path/to/file is different from /path/to/file. sh runs /bin/sh which is symlinked to /bin/dash.
    – Lekensteyn
    Nov 2, 2011 at 14:19
  • Just making something clear on the examples you see on the net, normally you see sh ./somescript which can also be typed as `sh /path/to/script/scriptitself'. Nov 2, 2011 at 14:37

I tried many ways and that's working well with me:

(cd ~/user/scripts/; ./someScript)

I get some help from this answer.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .