Cd

From LQWiki
Jump to: navigation, search

See also CD for compact disk


cd is the command in most command line environments for moving out of the current directory.

cd is always a shell builtin command, as changing the directory in a subshell would not have any effect. Changing the directory in a subshell has no effect on the working directory of its parent shell.

cd .. will move the current path up to the parent directory. cd ~ or cd with no arguments will move the current path to the user's home directory ($HOME). cd - will move back to the last visited directory ($OLDPWD) before the previous cd command.

To view the current directory, use the pwd command.

Directories with spaces or the '#' symbol in the name can be referenced by putting quotation marks around them: cd "some name"