% cd <directory name>: Changes the current working directory to the specified directory.
Example:
jp@ubuntu:~/demo$ pwd (pwd=>Print working directory)
/home/jp/demo
jp@ubuntu:~/demo$ ls
dir1 dir2 dir3 dir4 dir5
jp@ubuntu:~/demo$ cd dir1
jp@ubuntu:~/demo/dir1$ ls
jp@ubuntu:~/demo/dir1$ pwd
/home/jp/demo/dir1
jp@ubuntu:~/demo/dir1$
% pwd: Print name of current/ working directory.
jp@ubuntu:~/demo/dir1$ pwd
/home/jp/demo/dir1
% cd . : It will make you to stay in the current working directory. (.) means current working directory and (..) means previous directory.
Example:
jp@ubuntu:~/demo/dir1$ pwd
/home/jp/demo/dir1
jp@ubuntu:~/demo/dir1$ ls
jp@ubuntu:~/demo/dir1$ cd .
jp@ubuntu:~/demo/dir1$ pwd
/home/jp/demo/dir1
% cd .. : It will take you to your home directory.
Example:
jp@ubuntu:~/demo/dir1$ pwd
/home/jp/demo/dir1
jp@ubuntu:~/demo/dir1$ ls
jp@ubuntu:~/demo/dir1$ cd ../
jp@ubuntu:~/demo$ pwd
/home/jp/demo
jp@ubuntu:~/demo$ ls
dir1 dir2 dir3 dir4 dir5
jp@ubuntu:~/demo$
% cd ~: Changes your current working directory to home directory.
Example:
jp@ubuntu:~/demo$ pwd
/home/jp/demo
jp@ubuntu:~/demo$ ls
dir1 dir2 dir3 dir4 dir5
jp@ubuntu:~/demo$ cd ~
jp@ubuntu:~$ pwd
/home/jp
jp@ubuntu:~$ ls
cpgms demo Desktop
% cd : Changes your current working directory to home directory.
Example:
jp@ubuntu:~/demo/dir1$ pwd
/home/jp/demo/dir1
jp@ubuntu:~/demo/dir1$ ls
jp@ubuntu:~/demo/dir1$ cd
jp@ubuntu:~$ pwd
/home/jp
jp@ubuntu:~$ ls
cpgms demo Desktop
% cd / : Changes your current working directory to root directory.
Example:
jp@ubuntu:~$ pwd
/home/jp
jp@ubuntu:~$ cd /
jp@ubuntu:/$ pwd
/
jp@ubuntu:/$
Example:
jp@ubuntu:~/demo$ pwd (pwd=>Print working directory)
/home/jp/demo
jp@ubuntu:~/demo$ ls
dir1 dir2 dir3 dir4 dir5
jp@ubuntu:~/demo$ cd dir1
jp@ubuntu:~/demo/dir1$ ls
jp@ubuntu:~/demo/dir1$ pwd
/home/jp/demo/dir1
jp@ubuntu:~/demo/dir1$
% pwd: Print name of current/ working directory.
jp@ubuntu:~/demo/dir1$ pwd
/home/jp/demo/dir1
% cd . : It will make you to stay in the current working directory. (.) means current working directory and (..) means previous directory.
Example:
jp@ubuntu:~/demo/dir1$ pwd
/home/jp/demo/dir1
jp@ubuntu:~/demo/dir1$ ls
jp@ubuntu:~/demo/dir1$ cd .
jp@ubuntu:~/demo/dir1$ pwd
/home/jp/demo/dir1
% cd .. : It will take you to your home directory.
Example:
jp@ubuntu:~/demo/dir1$ pwd
/home/jp/demo/dir1
jp@ubuntu:~/demo/dir1$ ls
jp@ubuntu:~/demo/dir1$ cd ../
jp@ubuntu:~/demo$ pwd
/home/jp/demo
jp@ubuntu:~/demo$ ls
dir1 dir2 dir3 dir4 dir5
jp@ubuntu:~/demo$
% cd ~: Changes your current working directory to home directory.
Example:
jp@ubuntu:~/demo$ pwd
/home/jp/demo
jp@ubuntu:~/demo$ ls
dir1 dir2 dir3 dir4 dir5
jp@ubuntu:~/demo$ cd ~
jp@ubuntu:~$ pwd
/home/jp
jp@ubuntu:~$ ls
cpgms demo Desktop
% cd : Changes your current working directory to home directory.
Example:
jp@ubuntu:~/demo/dir1$ pwd
/home/jp/demo/dir1
jp@ubuntu:~/demo/dir1$ ls
jp@ubuntu:~/demo/dir1$ cd
jp@ubuntu:~$ pwd
/home/jp
jp@ubuntu:~$ ls
cpgms demo Desktop
% cd / : Changes your current working directory to root directory.
Example:
jp@ubuntu:~$ pwd
/home/jp
jp@ubuntu:~$ cd /
jp@ubuntu:/$ pwd
/
jp@ubuntu:/$