Unix Comands: cd
Posted 01/23/2011 at 3:29pm
| by Cory Bohon

No, we’re not talking about those old compact discs that people used to listen to, we’re talking about “change directory.” This command does just that. Type this command followed by the name of a directory that you wish to change to, and it’ll change to that directory.
If you had a Music directory inside of the current folder you’re browsing, you could type:
cd Music
This would change to the music directory.
Just like the ls command, there’s a few variations on the cd command:
cd - Just typing the command without a directory name after it will take you back to your home directory.
cd .. - Typing the command with two periods after it will take you one-level up in the hierarchy (this means the parent directory to the directory that you’re currently in). So, if you were in the Music directory and wanted to move back up to the parent directory you just moved from, you could type this command. Think of this functionality as pressing the back button in a Finder window.