Pushd and popd

From Christoph's Personal Wiki
Revision as of 23:01, 6 November 2008 by Christoph (Talk | contribs) (New page: '''<code>pushd</code>''' and '''<code>popd</code>''' are command line tools used to work with the command line directory stack. The '''<code>pushd</...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

pushd and popd are command line tools used to work with the command line directory stack.

The pushd command saves the current working directory in memory so it can be returned to at any time, optionally changing to a new directory. The popd command returns to the path at the top of the directory stack.

Syntax

pushd

pushd [path | ..]

Arguments:

  • path This command-line argument specifies the directory to make the current directory.

popd

popd

Example

pushd .  # save current working directory (e.g., /home/)
cd /tmp  # change to some other directory
popd     # change back to previous dir (e.g., /home/)

References

Linux command line programs
File and file system management: cat | cd | chmod | chown | chgrp | umask | cp | du | df | file | fsck | ln | ls | lsof | mkdir | more | mount | mv | pwd | rcp | rm | rmdir | split | touch | tree
Process management: anacron | at | chroot | cron/crontab | kill | nice | ps | sleep | screen | time | timex | top | nice/renice | wait
User Management/Environment: env | finger | id | locale | mesg | passwd | su | sudo | uname | uptime | w | wall | who | write
Text processing: awk | cut | diff | ex | head | tac | tee | iconv | join | less | more | paste | sed | sort | tail | tr | uniq | wc | xargs | perl
Shell programming: echo | expr | unset Printing: lp
Communications:
inetd | netstat | ping | rlogin | traceroute
Searching:

find | grep/egrep/fgrep | strings

Miscellaneous:

banner | bc | cal | man | yes