8

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.

7 Answers 7

43

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

2
  • 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. Commented Jan 18, 2010 at 11:20
  • 1
    . and .. are provided by the filesystem, and so available everywhere. But ~ is interpreted by the shell, and so can only be used in shell command lines; other programs will treat it as a literal filename.
    – gidds
    Commented Apr 5, 2022 at 15:53
7
. Current Directoy

.. Parent Directory

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

1
  • 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
    Commented Oct 1, 2009 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.
2
  • 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
    Commented Oct 1, 2009 at 11:10
  • Oh yeah it might be a regular file as well. Commented Oct 1, 2009 at 11:11
1

../ is the directory above this one

./ is the current directory

1

./ means the current directory.

0

I think , ./ and . are the same, they mean current directory. While ../ means first layer parent directory.

1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Apr 5, 2022 at 14:56

You must log in to answer this question.

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