Options (version Specific)
- no attributes Return to the home directory (UNIX) or print the full path of the current directory (DOS and Windows)
- -p Print the final directory stack, just like dirs.
- -l '~' (UNIX only) or '~name' (UNIX only) in the output is expanded explicitly to home or the pathname of the home directory for user name.
- -n Entries are wrapped before they reach the edge of the screen.
- -v entries are printed one per line, preceded by their stack positions.
- cd\ (DOS and Windows only) returns to the root dir. Consequently, command
cd\subdir
always takes the user to the named subdirectory on the root directory, regardless of where he is located when the command is issued.
Application of some options (unix)
"cd" by itself or cd ~ will always put you in your home directory.
"cd ." will leave you in the same directory you are currently in (i.e. your current directory won't change)
"cd ~username" will put you in username's home directory.
"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 -" 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.
Read more about this topic: Cd (command)