The function of the linux cd command is to switch the current working directory; the syntax of the cd command is "cd [dirName]", where the dirName representation can be an absolute path or a relative path; if the directory name is omitted, it changes to The user's home directory, the symbol "~" also represents the home directory, the symbol "." represents the current directory, and the symbol ".." represents the directory above the current directory location.
#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.
Detailed explanation of the linux cd command
The Linux cd (full English spelling: change directory) command is used to switch the current working directory.
Usage:cd [dirName]
where dirName is the directory name, which can be an absolute path or a relative path. If the directory name is omitted, it will switch to the home directory. ~ also means the home directory, . means the current directory, .. means the directory above the current directory.
The following is an example:
Jump to /usr/bin/
$ cd /usr/bin/
Jump to home directory
$ cd ~ 或 $ cd
Jump to root directory
$ cd /
Return to the directory where you were before entering the current directory
$ cd -
Jump to the upper level of the current directory
$ cd ..
Jump to the upper level of the current directory
$ cd ../..
The above are Usage of cd command
Sometimes you are not sure of the directory you are in. You can type pwd and you will see the path of the current directory
Recommended learning: "Linux Video Tutorial"
The above is the detailed content of Detailed explanation of linux cd command. For more information, please follow other related articles on the PHP Chinese website!