PUSHD
   HOME

TheInfoList



OR:

pushd and popd are
shell Shell may refer to: Architecture and design * Shell (structure), a thin structure ** Concrete shell, a thin shell of concrete, usually with no interior columns or exterior buttresses Science Biology * Seashell, a hard outer layer of a marine ani ...
command Command may refer to: Computing * Command (computing), a statement in a computer language * command (Unix), a Unix command * COMMAND.COM, the default operating system shell and command-line interpreter for DOS * Command key, a modifier key on A ...
s that together allow the user to revert to a previous
working directory In computing, the working directory of a process is a directory of a hierarchical file system, if any, dynamically associated with the process. It is sometimes called the current working directory (CWD), e.g. the BSD getcwd function, or just c ...
via the command line. They use a
stack Stack may refer to: Places * Stack Island, an island game reserve in Bass Strait, south-eastern Australia, in Tasmania’s Hunter Island Group * Blue Stack Mountains, in Co. Donegal, Ireland People * Stack (surname) (including a list of people ...
data structure In computer science, a data structure is a data organization and storage format that is usually chosen for Efficiency, efficient Data access, access to data. More precisely, a data structure is a collection of data values, the relationships amo ...
for directory paths. pushd pushes the working directory path onto the stack and changes to the specified directory, and popd pops the most recent item from the stack and changes directory to the popped value. Behavior varies if no argument is passed to pushd. On Unix, the command swaps the top two directories on the stack, which toggles between them. On Windows, the command lists the paths in the stack except for the current one. The commands are widely available as builtin commands in many shells, such as Bash,
Command Prompt A command-line interface (CLI) is a means of interacting with software via commands each formatted as a line of text. Command-line interfaces emerged in the mid-1960s, on computer terminals, as an interactive and more user-friendly alternativ ...
,
PowerShell PowerShell is a shell program developed by Microsoft for task automation and configuration management. As is typical for a shell, it provides a command-line interpreter for interactive use and a script interpreter for automation via a langu ...
,
C shell The C shell (csh or the improved version, tcsh) is a Unix shell created by Bill Joy while he was a graduate student at University of California, Berkeley in the late 1970s. It has been widely distributed, beginning with the 2BSD release of the ...
,
tcsh tcsh ( “tee-see-shell”, “tee-shell”, or as “tee see ess aitch”, tcsh) is a Unix shell based on and backward compatible with the C shell (csh). Shell It is essentially the C shell with programmable command-line completion, command- ...
,
4DOS 4DOS is a command-line interpreter by JP Software, designed to replace the default command interpreter COMMAND.COM in MS-DOS and Windows. It was written by Rex C. Conn and Tom Rawson and first released in 1989. Compared to the default, it has ...
,
Hamilton C shell Hamilton C shell is a Clone (computing), clone of the C shell, Unix C shell and Unix utilities, utilities Early for Microsoft Windows created by Nicole Hamilton at Hamilton Laboratories as a completely original work, not based on any prior cod ...
,
KornShell KornShell (ksh) is a Unix shell which was developed by David Korn (computer scientist), David Korn at Bell Labs in the early 1980s and announced at USENIX Annual Technical Conference, USENIX on July 14, 1983. The initial development was base ...
, and
FreeCOM Freecom is a German manufacturer of computer peripherals. Its products include USB hard disks (where the actual hard drive is manufactured by Samsung and others), USB flash drives, USB DVB-T television receivers and a data recovery In computin ...
. The stack of directory paths can be displayed via the dirs Unix command or Get-Location -stack PowerShell command. The working directory is at the top of the stack. The first
Unix shell A Unix shell is a Command-line_interface#Command-line_interpreter, command-line interpreter or shell (computing), shell that provides a command line user interface for Unix-like operating systems. The shell is both an interactive command languag ...
to provide a directory stack was Bill Joy's
C shell The C shell (csh or the improved version, tcsh) is a Unix shell created by Bill Joy while he was a graduate student at University of California, Berkeley in the late 1970s. It has been widely distributed, beginning with the 2BSD release of the ...
. The syntax for pushing and popping directories is essentially the same as that used now.man tcsh


Examples


Unix-like

ser@server /usr/ports$ pushd /etc /etc /usr/ports ser@server /etc$ popd /usr/ports ser@server /usr/ports$


Command Prompt and ReactOS

C:\Users\root>pushd C:\Users C:\Users>popd C:\Users\root>


See also

*
cd (command) is a shell command that changes the working directory. It is available in many shells and other applications that maintain a working directory. In some contexts, the command can perform actions other than change directory. Some environments p ...
*
List of DOS commands This article lists notable commands provided by the MS-DOS disk operating system (DOS), especially as used on an IBM PC compatible computer. Other DOS variants as well as the legacy Windows shell, Command Prompt (cmd.exe), provide many of these c ...
*
List of Unix commands This is a list of the shell commands of the most recent version of the Portable Operating System Interface (POSIX) IEEE Std 1003.1-2024 which is part of the Single UNIX Specification (SUS). These commands are implemented in many shells on moder ...


References


Further reading

* *


External links


pushd , Microsoft Docs

popd , Microsoft Docs
{{Windows commands Internal DOS commands Microcomputer software ReactOS commands Windows administration Computing commands