Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

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

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

6 Answers 6

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.

share|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
. Current Directoy

.. Parent Directory

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

share|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 ! –  vpram86 Oct 1 '09 at 11:15

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

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

share|improve this answer
  • . 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.
share|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. –  Tamas Czinege Oct 1 '09 at 11:11

../ is the directory above this one

./ is the current directory

share|improve this answer

./ means the current directory.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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