Unix programming reference
Please explain me:
$ cd /usr/local/bin
changes to directory /usr/local/bin
.
then to change to a directory /usr/home/amrood
from the current directory use the relative path:
$ cd ../../home/amrood
(these are double dots in a relative path, I don't understand)
amuses
Double dots in a unix file link mean "go up one directory". Therefore, if you are in /usr/local/bin
, ../..
it is that you are basically removing bin
and local
from your current path. (You move "up" two folders.) Then home
and are added amrood
, so you are in /usr/home/amrood
.
You are viewing one node of the tree with each one ..
. First /usr/local
, then /usr
). So you're in the directory usr
, which means you can go to home/amrood
. To shorten this, you can do ../../home/amrood
.
From, /usr/local/bin
you can use an absolute path:
$ cd /usr/home/amrood
Or a relative path:
$ cd ../../home/amrood
But no /usr/home/user
. To get into the user's current directory, you must use the shortcut ~
:
$ cd ~
$ pwd # /home/user
The double dot means "go to the parent directory".
So, for example, from the user's starting point:
$ pwd # /home/user
$ cd ..
$ pwd # /home