Format
pushd [-p] [-l] [-n|-v] [name|
+n]
Description
pushd with options, exchanges the top two elements of
the directory stack. If
pushdtohome is set,
pushd without
arguments does
pushd ~, like
cd. With
name,
pushd pushes the current working
directory onto the directory stack and changes to name. If name is
'-', it is interpreted as the previous working directory (see
File name substitution). If
dunique is set,
pushd removes
any instances of
name from the stack before
pushing it onto the stack. With a number
+n,
pushd rotates
the
n'th element of the directory stack around
to be the top element and changes to it. If
dextract is
set, however,
pushd +n extracts the
n'th directory, pushes it onto the top of the
stack and changes to it. So, instead of just rotating the entire stack
around,
dextract lets the user have the
n'th directory extracted from its current position,
and pushes it onto the top. For example:
> pushd /tmp
/tmp ~
> pushd /bin
/bin /tmp ~
> pushd /u
/u /bin /tmp ~
> pushd /usr
/usr /u /bin /tmp ~
> pushd +2
/bin /tmp ~ /usr /u
> set dextract
> dirs
/bin /tmp ~ /usr /u
> pushd +2
~ /bin /tmp /usr /u
>
Finally, all forms of pushd print the final directory
stack, just like dirs. The pushdsilent tcsh
shell variable can be set to prevent this.
Options
- –l
- Output is expanded explicitly to home or the path name of the
home directory for the user.
- -n
- Entries are wrapped before they reach the edge of the screen.
- -p
- Overrides pushdsilent.
- -v
- Entries are printed one per line, preceded by their stack postions.
If
more than one of -n or -v is given, -v takes
precedence.
Related information
cd, tcsh