cd command
LINUX-Frequently used commands
cd command Move to a different directory. |
Syntax |
cd directory |
The cd command moves to the specified directory. If you omit the directory name and just execute cd, you will be taken to the user's home directory. Both absolute and relative paths can be used to specify the directory name. |
Example: Move the directory (absolute path). |
$ cd /var/usr/ ← Go to /var/usr/ |
Example: Moving a directory (relative path) |
$ cd .. ← Go to the next directory up |
Example: Go to the home directory |
$ cd ← cd command only |
Example: Go to the user's home directory |
$ su - ← "su -" to become root passwd <Enter the root password> [root@Panser ~]# cd ~[user name] [root@Panser [username]]# |