O'Reilly logo

Linux Shell Scripting Cookbook by Sarath Lakshman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Fast command-line navigation using pushd and popd

When dealing with multiple locations on a terminal or shell prompt, our common practice is to copy and paste the paths. Copy-paste is only effective when mouse is used. When there is only command-line access without a GUI, it is hard to deal with navigation through multiple paths. For example, if we are dealing with locations /var/www, /home/slynux, and /usr/src, when we need to navigate these locations one by one, it is really difficult to type the path every time when we need to switch between the paths. Hence the command-line interface (CLI) based navigation techniques such as pushd and popd are used. Let's see how to practice them.

Getting ready

pushd and popd are used to switch between multiple ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required