一、作用

  1. 切换当前目录至其他目录

二、选项

    • 类似于返回键
  • . . 回到上一级目录
  • / 回到根目录
  • ~ 回到家目录
  • !$ 上一个命令使用的目录(目录=!$)

    三、实例

    ```

[root@xxxx:/etc/redhat-lsb ]# cd ~ [root@xxxx:~ ]#

```
[root@xxxx:~ ]# cd -
/etc/redhat-lsb
[root@xxxx:/etc/redhat-lsb ]# cd -
/root
[root@xxxx:~ ]# cd -
/etc/redhat-lsb
[root@xxxx:~ ]# cd /etc/
[root@xxxx:/etc ]#
[root@localhost ~]# ls /etc/sysconfig/network-scripts/
ifcfg-ens33  ifdown-eth   ifdown-post    ifdown-Team      ifup-aliases  ifup-ipv6   ifup-post    ifup-Team      init.ipv6-global
ifcfg-lo     ifdown-ippp  ifdown-ppp     ifdown-TeamPort  ifup-bnep     ifup-isdn   ifup-ppp     ifup-TeamPort  network-functions
ifdown       ifdown-ipv6  ifdown-routes  ifdown-tunnel    ifup-eth      ifup-plip   ifup-routes  ifup-tunnel    network-functions-ipv6
ifdown-bnep  ifdown-isdn  ifdown-sit     ifup             ifup-ippp     ifup-plusb  ifup-sit     ifup-wireless
[root@localhost ~]# 
[root@localhost ~]# cd !$
cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# 
[root@localhost network-scripts]# pwd
/etc/sysconfig/network-scripts