4

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.

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

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

31

./ 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.

  • 3
    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
6
. Current Directoy

.. Parent Directory

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

  • 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
4

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

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

3
  • . 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.
  • 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
1

../ is the directory above this one

./ is the current directory

1

./ means the current directory.

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.