Commands

cd

target_directory

Change directory. This command makes target_directory your current working directory. It is a strong contender for the single most commonly used command in Linux. target_directory may be either a relative path, an absolute path, a shell symbol, or a shell variable.

Example: In the examples on the usage of the cd command presented next, assume that the shell variable $BOB stands for /home/bob. The directory tree is the same as the sample directory tree printed in the front of this chapter:

Starting Directory target_directory Type Example Command Ending Directory
/home/shawkins relative cd linux /home/shawkins/linux
/home/shawkins absolute cd /home /home
/home/shawkins shell symbol cd .. /home
/home/shawkins shell ...

Get Linux® Desk Reference, Second Edition 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.