How to use the SSH cd command

The cd (change directory) command moves you between folders on your Linux hosting. In particular, it’s essential for navigating to your website files, logs, or config directories when working via SSH. Furthermore, cd works with absolute paths (from root) or relative paths (from your current location) – making it the primary way to move around the file system on a VPS, dedicated server, or shared hosting with SSH access.

Change to a directory

To move into a folder, use cd followed by the path:

cd /path/to/directory

Use an absolute path (starting with /) to go anywhere on the system. Example—navigate to your website files:

cd ~/public_html

The ~ (tilde) means your home directory. You can also use a relative path: cd public_html works if you’re already in your home folder.

Go up one level

To move to the parent directory:

cd ../

.. means “parent folder.” For example, from public_html/wp-content this takes you to public_html.

Go up two levels

To move up two directories:

cd ../../

Each ../ moves up one level. From public_html/wp-content/plugins, this takes you to public_html.

Go to home directory

To return to your home directory:

cd

Or explicitly:

cd ~

Both commands take you to your home folder (e.g. /home/username). The bare cd with no arguments does the same as cd ~.

Common use cases

Typical uses for cd on a Linux hosting account:

  • Navigating to public_html to manage website files
  • Moving into wp-content or wp-content/plugins for WordPress
  • Accessing log directories to check error or access logs
  • Reaching config folders before editing files with nano or vi

Use pwd to see your current directory. For listing files, see the SSH ls command. For creating directories, see the SSH mkdir command.

Need more help?

Explore more SSH and hosting guides in our knowledgebase. JetHost web hosting includes SSH access for managing your server directly.