If you’re wondering, can I:
- in unix, change to last directory
- in unix, cd to last used directory
- in unix change to most recent directory
cd - will switch you to the previous directory. For example, if you are in /usr/bin/tmp, and go to /etc, you can type cd – to go back to /usr/bin/tmp. You can use this to toggle back and forth between two directories.
cd dir (without a /) will put you in a subdirectory. for example, if you are in /usr, typing cd bin will put you in /usr/bin, while cd /bin puts you in /bin.
cd .. will move you up one directory. So, if you are /usr/bin/tmp, cd .. moves you to /usr/bin, while cd ../.. moves you to /usr (i.e. up two levels). You can use this indirection to access subdirectories too. So, from /usr/bin/tmp, you can use cd ../../local to go to /usr/local.
cd by itself or cd ~ will always put you in your home directory.
cd ~username will put you in username’s home directory.