linux基础命令:cd

て烟熏妆下的殇ゞ 提交于 2019-11-27 19:31:21

命令简介:

  该命令用来切换当前目录。cd 是change directory 的缩写

命令语法:

  cd  [-L|-P]  [dir]  

命令用法

1. 切换到指定目录

[test@VM_0_15_centos ~]$ cd  python/

2. 切换到上级目录

[test@VM_0_15_centos ~]$ cd  python/
[test@VM_0_15_centos python]$ pwd
/home/test/python
[test@VM_0_15_centos python]$ cd  ../
[test@VM_0_15_centos ~]$ pwd
/home/test

3. 切换到用户家目录

[test@VM_0_15_centos linux]$ cd  ../linux/
[test@VM_0_15_centos linux]$ pwd
/home/test/linux
[test@VM_0_15_centos linux]$ cd  ~
[test@VM_0_15_centos ~]$ pwd
/home/test

4. 切换到根目录

[test@VM_0_15_centos ~]$ cd  /
[test@VM_0_15_centos /]$ pwd
/

5. 返回上次所在目录

[test@VM_0_15_centos ~]$ pwd
/home/test
[test@VM_0_15_centos ~]$ cd  linux/
[test@VM_0_15_centos linux]$ cd  -
/home/test

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!