Traversing the Unix Tree

  • cd

    • This command name stands for "change directory".

    • It changes your current working directory to the specified location.

    • The last visited directory is referred to with a hyphen ("-").

# go to root directory of the system and print the working directory
cd /
pwd

# go to the home directory and print the working directory
cd ~
pwd

# change directory using the absolute path and print the working directory
cd /net/bmc-pub14/data/
pwd

Last updated

Massachusetts Institute of Technology