How do you change directory in Linux?

Answer

Use the cd (change directory) command. cd /path/to/dir moves to an absolute path. cd dirname moves into a subdirectory relative to the current location. cd .. moves up one level. cd ~ or just cd moves to your home directory. cd - returns to the previous directory. Example: cd /var/www/html navigates to the web root. The current directory is always represented by . and the parent by ...