Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
What does “/” , “./”, “../” represent while giving path?

Example: For running a django server I use: python runserver

But some people seem to use ./ runserver. This command seems to do the same as the previous one.

What exactly does the ./ part do?

share|improve this question

marked as duplicate by slhck Dec 13 '12 at 11:28

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 4 down vote accepted

. is the path of the current directory.
Every directory always have two special files, ., and .., where first represents itself, while second represents the parent directory.

By writing ./ runserver, you are running command with argument runserver. To see what happens when you execute, check what is the content of the file with less

To sum it up, there shouldn't be any difference in both cases, unless the python version stated in the is different than the default python version. The python used in can be seen at the first line.

share|improve this answer
Ok, so the first line of is #!/usr/bin/env python. ./file will always execute the file the binary provided by that path. So it's just better to write ./ then python because it's shorter. Correct? – Bentley4 Dec 13 '12 at 11:31
Bentley, you still don't appear to understand. It's not something you should bear in mind specific to Python. Check my answer. – deed02392 Dec 13 '12 at 11:37
Off Course, I just meant in this case but I guess I could've written it more clearly sorry. Could you explain why running python doesn't require to have executive permission while ./ does? – Bentley4 Dec 13 '12 at 11:47
Sure, the reason is that running 'python' doesn't need executive permission on is : In this case, is just an argument to command python. – bbaja42 Dec 13 '12 at 11:54

The ./ tells the shell that you are referring to a file in the current directory. If you wanted to call a program such as backup and this happened to be a binary available in one of the program directories on the system, the shell would by default run this binary.

However you might have been in a directory of your own programs which happened to have a binary called backup, too. You might hence not even realise that the system was actually running a completely different binary.

By using ./backup, you are specifying that you want the system to use the binary in the current working directory, as opposed to one available in the program dirs.

You can test this by using the Linux whereis command, which in this example might specify that backup is actually at /usr/bin/backup, instead of perhaps ~/backup.

share|improve this answer

The main reason for the use of ./ prefix is that the current directory is not in the $PATH variable. At least it shouldn't be, like in windows, where you have a ;. at the end of the PATH.

share|improve this answer

./ is a short hand method of doing an operation from the current directory.

../ is a short hand method of going "up" a folder before entering the folder name given.

share|improve this answer
What do you mean with 'root line'? Operating from the / (root) directory? This doesn't make any sense to me because there is no file in my / directory. – Bentley4 Dec 13 '12 at 11:18
@Bentley4 ./ means the current directory. See the other answers to this and the linked question for details. – Indrek Dec 13 '12 at 12:29
Sorry, root was a bad word choice. Thank you @indrek Too many "project roots" :( – Avik Dec 13 '12 at 13:01

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