Did you use a relative or absolute pathname when you used the cd ~ command?
- Did you use a relative or absolute pathname when you used the cd ~ command?

UNIX offers a shortcut in the relative pathname– that uses either the current or parent directory as reference and specifies the path relative to it. A relative path-name uses one of these cryptic symbols:
.(a single dot) - this represents the current directory.
..(two dots) - this represents the parent directory.
Now, what this actually means is that if we are currently in directory /home/kt/abc and now you can use as an argument to cd to move to the parent directory /home/kt as :
$pwd
/home/kt/abc
$cd .. ***moves one level up***
$pwd
/home/kt
NOTE: Now / when used with has a different meaning ;instead of moving down a level, it moves one level up:
$pwd
/home/kt/abc ***moves two level up***
$cd ../..
$pwd
/home
Example of Absolute and Relative Path:
Suppose you are currently located in home/kt and you want to change your directory to home/kt/abc. Let’s see both the absolute and relative path concepts to do this:
Changing directory with relative path concept :
$pwd
/home/kt
$cd abc
$pwd
/home/kt/abc
Changing directory with absolute path concept:
$pwd
/home/kt
$cd /home/kt/abc
$pwd
/home/kt/abc
Step by step
Solved in 2 steps









