Next: Repeating and editing previous
Up: Customizing your shell and
Previous: Customizing ls
Contents
The command cd does not allow for a lot of customization, but there
are two built-ins that can be used to extend the functionality of cd.
- pushd
pushd <new_dir> will push the current directory onto the
directory stack and cd to the new directory. This can be
aliased as alias pd=pushd.
- popd
popd is the corresponding pop operation. This will pop the top
directory on the stack and cd to it. This can be aliased as
alias bd=popd.
These are useful when you need to traverse a number of directories but
need to return to your current location when done. Of course, if you just
need to toggle between two directories, then cd - will do the
trick.
Amit Jain
2013-04-22