One linux Command every day (2): the cd command Linux cd command can be said to be the most basic command statement in Linux. Other command statements to be operated are built on the cd command. Therefore, to learn common Linux commands, you must first learn how to use cd commands. 1. command Format: cd [directory name] 2. command function: Switch the current directory to dirName 3. common example: www.2cto.com 3.1 Example 1: Enter the system root directory command: cd/output: [root @ localhost ~] # Cd/Description: Enter the root directory of the system. After the preceding command is executed, run the ls command to check whether the current directory has reached the root directory of the system: cd .. or cd .. // output: 1 [root @ localhost soft] # pwd2/opt/soft3 [root @ localhost soft] # cd .. 4 [root @ localhost opt] # cd .. // 5 [root @ localhost/] # pwd6/Note: You can use "cd .. "continue to return, you can reach the root directory command: cd .. /.. // output: 1 [root @ localhost soft] # pwd2/opt/soft3 [root @ localhost soft] # cd .. /.. // 4 [root @ localhost/] # pwd5/6 [root @ localhost/] # www.2cto.com Description: use cd Command to enter the parent directory of the current directory. Example 2: using the cd command to enter the current user's home directory "current user home directory" and "system root directory" is two different concepts. There are two methods to enter the current user's home directory. Command 1: cd output: 1 [root @ localhost soft] # pwd2/opt/soft3 [root @ localhost soft] # cd4 [root @ localhost ~] # Pwd5/root command 2: cd ~ Output: 1 [root @ localhost ~] # Cd/opt/soft/2 [root @ localhost soft] # pwd3/opt/soft4 [root @ localhost soft] # cd ~ 5 [root @ localhost ~] # Pwd6/root Example 3: Jump to the specified directory command: cd/opt/soft output: www.2cto.com 1 [root @ localhost ~] # Cd/opt/soft2 [root @ localhost soft] # pwd3/opt/soft4 [root @ localhost soft] # cd jdk1.6.0 _ 16/5 [root @ localhost jdk1.6.0 _ 16] # pwd6/ opt/soft/jdk1.6.0 _ 167 [root @ localhost jdk1.6.0 _ 16] # description: jump to the specified directory, starting from the root directory, and add/before the directory name. You can directly write the name of the subdirectory in the current directory. Example 4: return the directory command before entering the directory: cd-output: 1 [root @ localhost soft] # pwd2/opt/soft3 [root @ localhost soft] # cd-4/root5 [root @ localhost ~] # Pwd6/root7 [root @ localhost ~] # Cd-8/opt/soft9 [root @ localhost soft] # www.2cto.com Example 5: Use the parameters of the previous command as the cd parameter. Command: cd! $ Output: 1 [root @ localhost soft] # cd! $2 cd-3/root4 [root @ localhost ~] # Cd! $5 cd-6/opt/soft7 [root @ localhost soft] #