← All commands
Topic hub Terminal & Shell Scripting
Windows Linux Terminal & Shell Scripting Expanded guide Terminal

Windows doskey /history equivalent in Linux

Shows previously run commands. Linux keeps a much longer history than Windows.

Windows doskey /history
→
Linux equivalents
Debian/Ubuntu same command
history
Fedora same command
history
Arch same command
history

Overview

What this command does

On Windows, "doskey /history" is used to view command history. On Linux, the closest practical mapping shown here is "history". Shows previously run commands. Linux keeps a much longer history than Windows. This reference is grouped under Terminal & Shell Scripting → Terminal.

Migration tip: Press <kbd>Ctrl+R</kbd> to <strong>search your command history interactively</strong> — type part of a past command and it appears. This is one of the most powerful terminal productivity shortcuts.

Windows → Linux context

What changes when you use this on Linux?

Equivalent task, different tool

Windows doskey /history maps to history for this task. Treat this as a workflow mapping rather than a character-for-character syntax translation.

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

View command history

Shows previously run commands. Linux keeps a much longer history than Windows.

history

Show all recent commands with numbers

history 20

Show last 20 commands

!42

Re-run command number 42 from history

Ready to run

Copyable Linux commands

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

history
history 20
history | grep apt
!42

Walkthrough

Examples with explanations

# Windows: doskey /history
history               # show all history
history 20           # last 20 commands
history | grep apt  # find past apt commands

# Re-run a command by number:
  42  sudo apt update
!42                   # runs command 42 again

# Best shortcut:
Ctrl + R              # then type to search history

Reference

Common options and variations

Command or optionUse
historyShow all recent commands with numbers
history 20Show last 20 commands
!42Re-run command number 42 from history
!!Re-run the last command
!stringRe-run last command starting with 'string'
Ctrl+RInteractive reverse history search

Distro differences

Debian/Ubuntu vs Fedora vs Arch

Debian/Ubuntu, Fedora and Arch all use "history" 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 history Same command on this distribution.
Fedora same command history Same command on this distribution.
Arch same command history Same command on this distribution.

Keep learning

Related Terminal & Shell Scripting commands