UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: popdChapter 5
The C Shell
Next: Reference: rehash
 

pushd

pushd name
pushd  [+n]
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. See also dirs and popd.

Examples

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


Previous: Reference: popdUNIX in a Nutshell: System V EditionNext: Reference: rehash
Reference: popdBook IndexReference: rehash

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System