reset

Reinitialize the terminal to a sane state after display corruption or control character issues.

Category: System terminal tty console recovery

Install

# Typically part of ncurses or util-linux

# RHEL / Alma / Rocky
sudo dnf install ncurses

# Debian / Ubuntu
sudo apt install ncurses-bin

# openSUSE
sudo zypper install ncurses

# Arch
sudo pacman -S ncurses

What it does

reset reinitializes the terminal session. It clears the screen, resets terminal modes, restores sane input settings, and re-detects terminal type. It is commonly used when the display becomes garbled.

How it works (mechanical)

  • Reinitializes terminal settings using terminfo database.
  • Restores sane line discipline settings (similar to stty sane).
  • Clears screen and resets scrollback.
  • May prompt for terminal type if $TERM is unset.
  • Does not restart the shell — only resets terminal state.

Quick Start

# Fix a garbled terminal
reset

10 Practical Examples

# 1) Reset corrupted display
reset
# 2) After viewing binary file accidentally
cat binaryfile
reset
# 3) Compare with clearing screen only
clear
# 4) Restore sane terminal settings
stty sane
# 5) Check terminal type
echo $TERM
# 6) Force terminal type (if needed)
export TERM=xterm
reset
# 7) Use in SSH session recovery
reset
# 8) Combine with script session recording
script troubleshoot.log
reset
# 9) Fix terminal after Ctrl+S freeze
# Press Ctrl+Q, then:
reset
# 10) Inspect terminal capabilities
infocmp

Notes & Gotchas

  • Stronger than clear — resets modes, not just screen.
  • May prompt for terminal type if environment is misconfigured.
  • Does not fix shell-level issues (only terminal state).
  • Safe to run at any time.
  • Useful after binary data corruption in terminal.

Historical Context

reset originated in Unix environments where terminal sessions could easily become corrupted due to control characters or mismatched terminal types. It remains a simple recovery tool in modern systems.

Modern Equivalent

Terminal emulators often provide a GUI-based reset option, but the reset command remains the fastest CLI method for restoring terminal sanity — especially over SSH or console sessions.

Related Commands

  • clear — clear screen only.
  • stty — configure terminal line settings.
  • tty — show terminal device.
  • script — record terminal sessions.
  • infocmp — display terminal capability info.