2.7CD命令 cd 是change directory 目录的意思 cd -相互交互 回到上回目录 再输入又回到刚才目录

[root@localhost ~]# cd /etc/sysconfig/ [root@localhost sysconfig]# cd - /root [root@localhost ~]# cd - /etc/sysconfig [root@localhost sysconfig]# pwd /etc/sysconfig [root@localhost sysconfig]# cd - /root [root@localhost ~]# pwd /root [root@localhost ~]# cd - /etc/sysconfig

cd 只输入cd回到架目录下 回到root下

[root@localhost sysconfig]# cd [root@localhost ~]# pwd /root

cd ~ 波浪号就相当于架目录 就相当于root

[root@localhost ~]# cd /etc/sysconfig/ [root@localhost sysconfig]# cd ~ [root@localhost ~]# pwd /root

cd .. 回到上级目录 最顶尖的目录就是根 比如cd /1/2/3/ 回到2 回到1 回到根 最终回到根目录

[root@localhost ~]# cd /etc/sysconfig/network-scripts/ [root@localhost network-scripts]# pwd /etc/sysconfig/network-scripts [root@localhost network-scripts]# cd .. [root@localhost sysconfig]# pwd /etc/sysconfig [root@localhost sysconfig]# cd .. [root@localhost etc]# pwd /etc [root@localhost etc]# cd .. [root@localhost /]# pwd /

总结 cd 后面跟路径会到达指定的目录下 pwd 查看当前所在的路径 所在的目录文件夹 cd - 相互交互 回到上回目录 再输入又回到刚才目录 cd 只输入cd回到架目录下 回到root下 cd ~ 波浪号就相当于架目录 就相当于root cd .. 回到上级目录 最顶尖的目录就是根