Changing Directories with the cd Command

Use the cd (change directory) command to navigate through the Linux file system's directories. Use this command with a directory specification or pathname to move to a specified directory. This command is built in to each Linux shell, and can also be used as a shortcut to quickly move back to your home directory.

$ pwd
/home/michael
$ cd /usr/bin
$ pwd
/usr/bin
$ cd
/home/michael

If you enter the cd command by itself, you'll return to your home directory (specified in the $HOME environment variable). Move up to the next directory by entering two periods and a forward slash (../) with the cd command, like so:

$ pwd
/home/michael
$ cd ../
$ pwd
/home

SEE ALSO

To learn more about shell environment variables, ...

Get Practical Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.