To install click the Add extension button. That's it.

The source code for the WIKI 2 extension is being checked by specialists of the Mozilla Foundation, Google, and Apple. You could also do it yourself at any point in time.

4,5
Kelly Slayton
Congratulations on this excellent venture… what a great idea!
Alexander Grigorievskiy
I use WIKI 2 every day and almost forgot how the original Wikipedia looks like.
Live Statistics
English Articles
Improved in 24 Hours
Added in 24 Hours
Languages
Recent
Show all languages
What we do. Every page goes through several hundred of perfecting techniques; in live mode. Quite the same Wikipedia. Just better.
.
Leo
Newton
Brights
Milds

pushd and popd

From Wikipedia, the free encyclopedia

In computing, pushd and popd are a pair of commands which allow users to quickly switch between the current and previous directory when using the command line. When called, they use a directory stack to sequentially save and retrieve directories visited by the user.[1][2]

They are widely available as builtin commands in many command-line interpreters, such as 4DOS, Bash,[3] C shell, tcsh, Hamilton C shell, KornShell, cmd.exe and PowerShell, and for various operating systems including both Windows and Unix-like systems.

YouTube Encyclopedic

  • 1/5
    Views:
    1 814
    5 977
    6 196
    2 132
    397
  • Navigate Your Shell With pushd and popd - Quick Tip
  • The pushd and popd commands on linux, and the "cd -" command
  • Command Line Crash Course - Ex 08 - Moving Around (pushd, popd)
  • Powershell: pushd and popd
  • bash: pushd / popd (beginner - intermediate) anthony explains #185

Transcription

Overview

A diagram showing a vertical stack of identicallly-sized rectangles, representing the stack. An additional rectangle of the same type is shown on the left with an arrow indicating it being added to the stack, marked 'push'. A corresponding rectangle on the right, being removed from the top, is marked 'pop'.
A representation of a stack. Elements are always 'pushed' to and 'popped' from the top.

The directory stack underlies the functions of these two commands. It is an array of paths stored as an environment variable in the CLI, which can be viewed using the command dirs in Unix or Get-Location -stack in PowerShell. The current working directory is always at the top of the stack.

The pushd ('push directory') command saves the current working directory to the stack then changes the working directory to the new path input by the user. If pushd is not provided with a path argument, it changes instead to the next directory from the top of the stack,[clarification needed] which can be used to toggle between two directories.

The popd command removes (or 'pops', in the stack analogy) the current path entry from the stack and returns to the path at the top of the stack as the new working directory.[4][5]

The first Unix shell to implement a directory stack was Bill Joy's C shell.[citation needed] The syntax for pushing and popping directories is essentially the same as that used now.[6][7]

Both commands are available in FreeCOM, the command-line interface of FreeDOS.[8]

In Windows PowerShell, pushd is a predefined command alias for the Push-Location cmdlet and popd is a predefined command alias for the Pop-Location cmdlet. Both serve basically the same purpose as the pushd and popd commands.

Examples

Unix-like

[user@server /usr/ports] $ pushd /etc
/etc /usr/ports
[user@server /etc] $ popd
/usr/ports
[user@server /usr/ports] $

Microsoft Windows and ReactOS

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

CMD batch file

@echo off
rem This batch file deletes all .txt files in a specified directory
pushd %1
del *.txt
popd
echo All text files deleted in the %1 directory

Syntax

pushd

pushd [path | ..]

Arguments:

  • path This optional command-line argument specifies the directory to make the current directory. If path is omitted, the path at the top of the directory stack is used, which has the effect of toggling between two directories.

popd

popd

See also

References

  1. ^ Pushd - change directory/folder - Windows CMD - SS64.com
  2. ^ Popd - Windows CMD - SS64.com
  3. ^ Bash Reference Manual: Directory Stack Builtins
  4. ^ Microsoft TechNet Pushd article
  5. ^ Microsoft TechNet Popd article
  6. ^ Chapter 14 – 14.6 The Shells' pushd and popd Commands
  7. ^ man tcsh "TCSH(1)". Archived from the original on 2014-03-10. Retrieved 2014-11-03.
  8. ^ FreeCOM - FreeDOS

Further reading

External links

This page was last edited on 23 October 2023, at 14:04
Basis of this page is in Wikipedia. Text is available under the CC BY-SA 3.0 Unported License. Non-text media are available under their specified licenses. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc. WIKI 2 is an independent company and has no affiliation with Wikimedia Foundation.