命令简介:
该命令用来切换当前目录。cd 是change directory 的缩写
命令语法:
cd [-L|-P] [dir]
使用示例
1:切换到当前目录的上一级目录
1: [root@DB-Server sysconfig]# pwd
2: /etc/sysconfig
3: [root@DB-Server sysconfig]# cd ..
4: [root@DB-Server etc]# pwd
5: /etc
2:切换到当前目录的上上两层目录
1: [root@DB-Server etc]# cd sysconfig/
2: [root@DB-Server sysconfig]# pwd
3: /etc/sysconfig
4: [root@DB-Server sysconfig]# cd ../..
5: [root@DB-Server /]# pwd
6: /
3:切换到用户的宿主目录
1: [root@DB-Server sysconfig]# pwd
2: /etc/sysconfig
3: [root@DB-Server sysconfig]# cd ~
4: [root@DB-Server ~]# pwd
5: /root
4:切换到根目录
1: [root@DB-Server ~]# cd /
2: [root@DB-Server /]#
5:切换到某个目录,例如/etc/sysconfig/
1: [root@DB-Server ~]# cd /etc/sysconfig/
6: 返回进入当前目录前所在目录
1: [root@DB-Server ~]# cd /etc/sysconfig/
2: [root@DB-Server sysconfig]# cd -
3: /root
本文详细介绍了 Linux 系统中 cd 命令的使用方法,包括切换到当前目录的上级目录、用户的宿主目录、根目录等操作,并通过实例展示了如何使用 cd 命令进行目录跳转。
2756

被折叠的 条评论
为什么被折叠?



