Linux cd command Switch working directory

  
 

The cd command is used to switch the working directory. The switch directory path can be an absolute path or a relative path. If you do not enter a directory name, it will switch to the home directory of the currently logged in user. In addition: "~" also means the current home directory of the logged-in user, "." means the current directory, ".." means the directory above the current directory location.


Syntax format
cd [dirName]


Parameters
-p: If the target directory to be switched to is a symbolic link, directly Switch to the target directory pointed to by the symbolic link -L: If the target directory to be switched is a symbolic connection, switch directly to the directory represented by the character connection name, not the target directory pointed to by the symbolic link - when only practical "- " When an option is selected, the current working directory will be switched to the directory represented by the environment variable "OLDPWD"


example

Switch to the root directory. The command is as follows:
cd /

Switch to the /etc directory. The command is as follows:
cd /etc

Copyright © Windows knowledge All Rights Reserved