linux基础命令:cd

命令简介:

  该命令用来切换当前目录。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
原文地址:https://www.cnblogs.com/wzy23/p/11374311.html