# The `cd` command The `cd` command is used to change the current working directory *(i.e., the directory in which the current user is working)*. The "cd" stands for "**c**hange **d**irectory" and it is one of the most frequently used commands in the Linux terminal. The `cd` command is often combined with the `ls` command (see chapter 1) when navigating through a system. You can also press the `TAB` key to auto-complete directory names, or press `TAB` twice to list available directories in the current location. ### Syntax: ``` cd [OPTIONS] [directory] ``` ### Basic Examples: 1. **Change to a specific directory:** ``` cd /path/to/directory ``` 2. **Change to your home directory:** ``` cd ~ ``` OR simply: ``` cd ``` 3. **Change to the previous directory:** ``` cd - ``` This will also print the absolute path of the previous directory. 4. **Change to the system's root directory:** ``` cd / ``` 5. **Move up one directory level (parent directory):** ``` cd .. ``` 6. **Move up multiple directory levels:** ``` cd ../../.. ``` This example moves up three levels. ### Practical Examples: **Using relative paths:** ``` cd Documents/Projects/MyApp ``` **Using absolute paths:** ``` cd /usr/local/bin ``` **Combining with home directory shortcut:** ``` cd ~/Downloads ``` **Navigate to a directory with spaces in the name:** ``` cd "My Documents" ``` OR ``` cd My\ Documents ``` **Switch between two directories:** ``` cd /var/log cd /etc cd - # Returns to /var/log cd - # Returns to /etc ``` ### Additional Flags and Their Functionalities |**Short flag** |**Long flag** |**Description** | |:---|:---|:---| |`-L`|