In what directory will the command cd .. not do anything at all?


Transfered from Linux Config Disqus comments:


In what directory will the command ‘cd …’ (note the two dots in this command) not do anything at all?


In root directory “/”.

Since the … directory points to a parent directory and / ( root directory ) is on the top of the file system hierarchy standard and therefore it does not have a parent directory, the “cd …” command will not do anything at all. We may also say that / directory is a parent directory of itself. Try:

$ cd /
$ pwd
$ cd ..
$ pwd

Long Answer:

Every directory in the linux file system contains two special directories and they are:
[li]"." a current working directory [/li][li]"…" a parent directory [/li][/ul]

To see these special directories enter command:

ls -a

Current working directory “.” points to itself.


The command below will copy a file from /tmp directory to a current working directory:

cp /tmp/file .

Ore check disk space mounted below my current working directory:

df -h .

Parent directory “…” points to a directory one above my current working directory.


Use a symbolic path to navigate to different directory in the same parent directory:

$ pwd
$ cd ../etc/
$ pwd

Navigate two directories above my current directory:

$ pwd
$ cd ../..
$ pwd

opened #2

closed #3

opened #4