O'Reilly logo

Linux in a Nutshell, Fourth Edition by Aaron Weber, Stephen Figgins, Ellen Siever

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

Name

pushd

Synopsis

                  pushd 
                  name
                  pushd [options]
pushd
               

The first form changes the working directory to name and adds it to the directory stack. The second form rotates the nth entry to the beginning, making it the working directory. (Entry numbers begin at 0.) With no arguments, pushd switches the first two entries and changes to the new current directory. The +n, -l, -n, and -v options behave the same as in popd. See also dirs and popd.

Examples

% dirs
/home/bob /usr
% pushd /etc           
                  Add /etc to directory stack
/etc /home/bob /usr
% pushd +2             
                  Switch to third directory
/usr /etc /home/bob
% pushd                
                  Switch top two directories
/etc /usr /home/bob
% popd                 
                  Discard current entry; go to next
/usr /home/bob

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