Could anyone explain the difference between ../ and ./ please.

../system
./system

My understanding is that ../ is the root directory.

But I don't know what ./ means.

link|improve this question

71% accept rate
feedback

migrated from stackoverflow.com Oct 11 '09 at 20:44

This question came from our site for professional and enthusiast programmers.

6 Answers

up vote 27 down vote accepted

./ means the current directory

../ means the parent of the current directory, not the root directory

/ is the root directory

myfile.text is in the current directory, as is ./myfile.text

../myfile.text is one level above you and /myfile.text lives in your root directory.

link|improve this answer
To add more detail for future readers: ~/ is your home directory, and you can combine the operators above: ../../file would be a file two directories below. – Rich Bradshaw Jan 18 '10 at 11:20
feedback
. Current Directoy

.. Parent Directory

./system means, a directory/file called system in the current directory.

link|improve this answer
However, there would be little use preceding "system" with a "./" if it is a directory -- it's probably an executable. In UNIX/Linux systems, the current directory is not included in the search path for executables, so to run an executable in the current directory, you would preced it with "./" – aviraldg Oct 1 '09 at 11:11
Yes... I understand..I will edit it.thanks ! – Aviator Oct 1 '09 at 11:15
feedback

The . and .. are relative directories to your current location.

The . is the current directory. eg "this". The .. is the previous directory. eg "this.parent".

link|improve this answer
feedback
  • . is the current directory
  • .. is the parent directory of the current directory

... which means:

  • ./system is the subdirectory or file called "system" of the current directory
  • ../system is the subdirectory or file called "system" of the parent directory, which makes it a sibling of the current directory.
link|improve this answer
However, there would be little use preceding "system" with a "./" if it is a directory -- it's probably an executable. In UNIX/Linux systems, the current directory is not included in the search path for executables, so to run an executable in the current directory, you would preced it with "./" – aviraldg Oct 1 '09 at 11:10
Oh yeah it might be a regular file as well. – DrJokepu Oct 1 '09 at 11:11
feedback

../ is the directory above this one

./ is the current directory

link|improve this answer
feedback

./ means the current directory.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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