“4. Add Directories To the Directory Stack With PUSHD
“While we’re on the subject of directories, let’s talk about the
directory stack. Quite simply, this is a list of directories stored
by bash. The currently-browsed directory always tops the list, but
the list is otherwise empty until you add a new directory, which
you can do using the pushd command. For example, pushd /usr/bin
will add /usr/bin. It will also switch you to that directory, so
you could use it instead of cd to navigate (the -n command option
will let you add a directory but stay where you are). The dirs
command will show the directory list (remember that the
currently-browsed directory will always be at the top). popd
deletes the topmost entry in the list, and switches you to the next
in the list. Give the directory list a try. It can be very useful
if you’re administering a system and have to leap from directory to
directory, and are inclined to forget where important things
are.”
10 Expert Ubuntu Tricks
By
Get the Free Newsletter!
Subscribe to Developer Insider for top news, trends, & analysis