YouTip LogoYouTip

Linux Comm Cd

# Linux cd Command [![Image 3: Linux Command Manual](#) Linux Command Manual](#) The Linux cd (full English name: change directory) command is used to change the current working directory, switching to a specified path. If the directory name is omitted, it changes to the user's home directory (i.e., the directory where they logged in). Additionally, ~ also represents the home directory, . represents the current directory, and .. represents the parent directory of the current location. ### Syntax cd * dirName: The target directory to switch to, which can be a relative or absolute path. **Switch to absolute path:** Specify the full directory path to switch to the target directory. cd /path/to/directory **Switch to relative path:** Specify the path relative to the current directory to switch to the target directory. cd relative/path/to/directory ### Examples Switch to the /usr/bin/ directory: cd /usr/bin **Switch to parent directory:** Use .. to represent the parent directory. You can switch to higher-level directories by using .. consecutively. cd .. cd ../../ // Switch to the grandparent directory **Switch to user home directory (home):** Use ~ to represent the current user's home directory. You can use the cd command to switch directly to the home directory. cd ~ **Switch to the last accessed directory:** Use cd - to switch to the last accessed directory. cd - **Switch to directory specified by environment variable:** You can use an environment variable to specify the target directory and use the cd command to switch to that directory. cd $VAR_NAME The above examples are some basic uses of the cd command, which can help you perform directory switching operations in a Linux system. Use the cd --help command to get more detailed information about the cd command, including available options and more advanced usage. [![Image 4: Linux Command Manual](#) Linux Command Manual](#)
← Linux Comm DfLinux Comm Ftpcount β†’