1.cd
cd is short for the English word change directory, its function is to change the current working directory.
Note: All directory and file names in Linux are case-sensitive
Order | meaning |
cd | Switch to the current user's home directory (/home/user directory) |
cd ~ | Switch to the home directory of the current user (/home/user directory) ~ is the home directory of the current user |
cd . | keep the current directory unchanged |
cd .. | switch to the parent directory |
cd - | Can switch back and forth between the last two working directories |
Such as:
In the ~ directory pwd, the output /home/alexlu is the home directory of the current user, indicating that ~ is the home directory of the current user.
Also don't forget that / stands for the root directory.
2. Absolute path and relative path
Relative path : When entering a path, the front is not / or ~, which indicates the directory location relative to the current directory .
Absolute path : When entering the path, the front is / or ~, indicating the specific directory location starting from the root directory/home directory