A day of school a Linux command: cd pwd next day

Article Updated: 2020-03-08
Note: This article referring to man pwd manual, use and give examples.

First, the command cdandpwd

1, Command Introduction

pwdTo view the current directory path.
cdCommand is used to change the current directory.

Note: cdthe system built-in command, if you man cdfind that shows the bashcontent.

2, syntax

pwd [-L] [-P] [--help] [--version]
cd [-L|[-P [-e]]] [dir]

3, use the sample

Use Case

4, pwd parameters

Short format Long format description
-L - -logical If you are coming from a symbolic link, the path where the symbolic link is displayed
-P - -physical Whether it is not coming from a symbolic link, it shows the actual path (physical) of
- -help Displays help information about the command
- -version View version command

5, cd parameters

Short format Explanation description
No arguments Equivalent cd ~, switch to the current user's home directory
~or-- The top left of the keyboard tilde or minus two Switch to the current user's home directory
- Dash / minus sign Switch to the last cdto directory
.. Two points Switch to the parent directory
-L If the handover target is a symbolic link, is displayed进入的是逻辑上的符号链接目录
-P If the handover target is a symbolic link, is displayed进入的是实际指向的目录

Second, the practice of command

1, cd change directory

For example

2. Exceptions to the cd

cd-

3, pwd -Land pwd -Pthe difference

The difference pwd-lp

4, cd -Land cd -Pthe difference

Compared

三、Enjoy!

Published 75 original articles · won praise 8 · views 10000 +

Guess you like

Origin blog.csdn.net/qq_21516633/article/details/104742545