cd命令小技巧

(1)从任一目录回到用户的home目录:“cd”或“cd ~”。举例如下:

[root@localhost ~]# cd /home/iso/
[root@localhost iso]# pwd
/home/iso
[root@localhost iso]# cd
[root@localhost ~]# pwd
/root
[root@localhost ~]# cd /home/iso/
[root@localhost iso]# pwd
/home/iso
[root@localhost iso]# cd ~
[root@localhost ~]# pwd
/root

(2)回到之前的工作目录:“cd -”。举例如下:

[root@localhost ~]# pwd
/root
[root@localhost ~]# cd -
/home/iso
[root@localhost iso]# pwd
/home/iso