← All commands
Topic hub File Management
Windows Linux File Management Expanded guide File System

Windows pushd / popd equivalent in Linux

Saves your current directory to a stack so you can jump back to it later after navigating elsewhere.

Windows pushd / popd
→
Linux equivalents
Debian/Ubuntu same command
pushd / popd
Fedora same command
pushd / popd
Arch same command
pushd / popd

Overview

What this command does

On Windows, "pushd / popd" is used to save and restore directory location. On Linux, the closest practical mapping shown here is "pushd / popd". Saves your current directory to a stack so you can jump back to it later after navigating elsewhere. This reference is grouped under File Management → File System.

Migration tip: These commands work the same in Linux! <code>pushd</code> saves your spot, <code>popd</code> returns you to it. <code>dirs</code> shows the full directory stack.

Windows → Linux context

What changes when you use this on Linux?

Same name, different environment

The basic command name pushd is familiar on both platforms, but Linux path rules, quoting, permissions and available options can still change the result.

Portable across the compared distros

The Debian/Ubuntu, Fedora and Arch rows use the same command in this mapping. Package availability or defaults can still vary, so check the installed tool version when an option behaves differently.

Practical tasks

Common use cases

Save and restore directory location

Saves your current directory to a stack so you can jump back to it later after navigating elsewhere.

pushd /some/path

Save current dir and go to path

popd

Return to last saved directory

dirs

Show the full directory stack

Ready to run

Copyable Linux commands

Review paths, device names, package names and permissions before running any command.

pushd /var/log/nginx
popd
pushd ~/Projects
pushd /etc
dirs -v

Walkthrough

Examples with explanations

# Save your place, go deep, come back
pushd /var/log/nginx    # go there, save current dir
  (do some work...)
popd                      # return to where you were

# Stack multiple directories:
pushd ~/Projects
pushd /etc
dirs -v               # shows: 0=/etc 1=~/Projects 2=...
popd                   # back to ~/Projects

Reference

Common options and variations

Command or optionUse
pushd /some/pathSave current dir and go to path
popdReturn to last saved directory
dirsShow the full directory stack
dirs -vShow stack with index numbers

Distro differences

Debian/Ubuntu vs Fedora vs Arch

Debian/Ubuntu, Fedora and Arch all use "pushd / popd" for this mapping. The command syntax shown here is portable across the three rows, although installed versions and system defaults can still vary.

DistributionPackage manager / baseEquivalent commandDifference to notice
Debian/Ubuntu same command pushd / popd Same command on this distribution.
Fedora same command pushd / popd Same command on this distribution.
Arch same command pushd / popd Same command on this distribution.

Keep learning

Related File Management commands