The answers are correct, but I would like to tell you a different thing. Run the following command,
┌─[luvpreet@DHARI-Inspiron-3542] - [~/Desktop/drf-vogo] - [2017-09-01 08:57:42]
└─[0] ls -la
total 60
drwxrwxr-x 14 luvpreet luvpreet 4096 Aug 14 15:30 .
drwxr-xr-x 21 luvpreet luvpreet 4096 Sep 1 00:27 ..
You will notice that, first 2 lines, they have .
and ..
Now, this .
is the pointer to the very current directory you are in. And ..
is the pointer to it's parent directory .
When you do cd ..
,
monitoring-server@monitoring-server:~/kibana-project$ cd ..
monitoring-server@monitoring-server:~$
It moves to the parent directory.
When you do cd .
,
monitoring-server@monitoring-server:~/kibana-project$ cd .
monitoring-server@monitoring-server:~/kibana-project$
It remains in the same directory.
Now, ../testfile.txt
, is pointing to the testfile.txt
file in the parent directory. And ./testfile.txt
is pointing to the testfile in the current directory.
Therefore, ././././././././
, as much as possible, it remains in the same directory.
And ../../../../
will keep going 1 level up to the parent directory.
..
entry which points to its parent directory." – And if that directory is/
, it is its own parent. – Jörg W Mittag Sep 01 '17 at 17:21..
in the middle of a path! So~/Documents/../Pictures/
points to the same location as~/Pictures/
. It's just a more confusing way to point to~/Pictures/
– zck Sep 01 '17 at 18:37~/Documents/
is a link. – maaartinus Sep 01 '17 at 19:27cd -P
uses the physical structure: it resolves symlinks before processing instances of..
. Runhelp cd
for more. IIRC, there's a shell option to make that behaviour the default, instead of-L
. – Peter Cordes Sep 01 '17 at 22:18