Windows pause equivalent in Linux
Halts a script and waits for the user to press a key before continuing. Used frequently in batch files.
pause
read -p
read -p
read -p
Overview
What this command does
On Windows, "pause" is used to pause a script and wait for keypress. On Linux, the closest practical mapping shown here is "read -p". Halts a script and waits for the user to press a key before continuing. Used frequently in batch files. This reference is grouped under Terminal & Shell Scripting → Terminal.
Windows → Linux context
What changes when you use this on Linux?
Equivalent task, different tool
Windows pause maps to read -p 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.
For the broader concept behind this mapping, read Linux command-line basics.
Practical tasks
Common use cases
Pause a script and wait for keypress
Halts a script and waits for the user to press a key before continuing. Used frequently in batch files.
read -p 'Press Enter...'
Wait for Enter key
read -n 1 -s
Wait for any single key (silent)
read -t 10
Auto-continue after 10 seconds
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
read -p 'Press Enter to continue...'
read -n 1 -s -p 'Press any key...'
echo
read -t 10 -p 'Auto-continuing in 10s... ' || true
Walkthrough
Examples with explanations
# Windows: pause
read -p 'Press Enter to continue...'
# Wait for any key (no Enter needed):
read -n 1 -s -p 'Press any key...'
echo # newline after
# Auto-continue after timeout:
read -t 10 -p 'Auto-continuing in 10s... ' || true
Reference
Common options and variations
| Command or option | Use |
|---|---|
read -p 'Press Enter...' | Wait for Enter key |
read -n 1 -s | Wait for any single key (silent) |
read -t 10 | Auto-continue after 10 seconds |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
Debian/Ubuntu, Fedora and Arch all use "read -p" for this mapping. The command syntax shown here is portable across the three rows, although installed versions and system defaults can still vary.
| Distribution | Package manager / base | Equivalent command | Difference to notice |
|---|---|---|---|
| Debian/Ubuntu | same command | read -p |
Same command on this distribution. |
| Fedora | same command | read -p |
Same command on this distribution. |
| Arch | same command | read -p |
Same command on this distribution. |
Keep learning