How to Clear Entire Terminal Input: A Complete Guide

Whether you're working in a Linux shell, macOS Terminal, or Windows Command Prompt, knowing how to quickly clear your terminal input saves time and reduces clutter. The techniques vary depending on your operating system, shell type, and what exactly you mean by "clear" — wiping the current line you're typing, clearing the visible screen, or erasing the full scroll buffer.

What Does "Clear Terminal Input" Actually Mean?

This phrase covers a few different actions, and mixing them up leads to frustration:

  • Clearing the current line — deleting what you've typed before pressing Enter
  • Clearing the screen — removing visible output so the prompt sits at the top
  • Clearing the scroll buffer — wiping everything, including content you'd normally scroll up to see

Each has its own keyboard shortcuts and commands. Understanding the difference helps you pick the right method for the situation.

How to Clear What You've Typed on the Current Line

If you've started typing a command and want to erase it without executing it, these shortcuts work in most Unix-based terminals (Linux, macOS):

  • Ctrl + U — Deletes everything from the cursor to the beginning of the line
  • Ctrl + K — Deletes everything from the cursor to the end of the line
  • Ctrl + A then Ctrl + K — Moves to the start of the line first, then deletes the entire thing
  • Ctrl + W — Deletes the word immediately before the cursor (useful for partial corrections)
  • Alt + D — Deletes the word immediately after the cursor

On Windows Command Prompt, the behavior is slightly different. Esc clears the entire current line in most cases. In PowerShell, Ctrl + C cancels the line without executing it, which effectively clears your input.

In Bash and Zsh (common on Linux and macOS), these shortcuts are part of the Readline library, which handles keyboard input for interactive shells. Fish shell has its own input handling but supports similar shortcuts.

How to Clear the Terminal Screen 🖥️

Clearing the screen removes visible output and pushes your prompt to the top, but in most cases the scroll history is still accessible by scrolling up.

Universal command (works nearly everywhere):

clear 

Keyboard shortcut:

  • Ctrl + L — Works in Bash, Zsh, Fish, and many other terminals on Linux and macOS. Equivalent to running clear.

On Windows:

  • Command Prompt: cls
  • PowerShell: Clear-Host or its alias cls
  • Ctrl + L also works in some modern Windows Terminal configurations
EnvironmentScreen Clear CommandKeyboard Shortcut
Bash / Zsh (Linux/macOS)clearCtrl + L
Fish ShellclearCtrl + L
Windows CMDcls
PowerShellClear-Host / clsCtrl + L (Windows Terminal)

How to Clear the Entire Scroll Buffer

This is what most people mean when they want to truly wipe everything — not just the visible screen, but the entire history you can scroll back through.

On macOS Terminal:

  • Cmd + K — Clears both the visible screen and the entire scroll buffer. This is the most thorough option available without extra configuration.

On Linux (GNOME Terminal, Konsole, etc.):

  • The command reset reinitializes the terminal and clears the buffer more aggressively than clear
  • Some terminal emulators have a "Reset and Clear" option in their Edit or View menus
  • Ctrl + L only clears the visible portion; reset goes further

Using an escape sequence directly:

printf '33[2J33[3J33[H' 

This sequence clears the screen (33[2J), clears the scroll buffer (33[3J), and moves the cursor to the top (33[H). It works in terminals that support ANSI escape codes, which includes most modern terminal emulators on Linux and macOS.

On Windows Terminal (the modern app):

  • Ctrl + Shift + F opens find; but for buffer clearing, right-clicking the tab and selecting "Clear Buffer" works in recent versions
  • PowerShell users can run [System.Console]::Clear() for a more complete screen wipe

Shell vs. Terminal Emulator: Why the Distinction Matters 🔍

A common source of confusion is the difference between the shell (Bash, Zsh, Fish, PowerShell) and the terminal emulator (GNOME Terminal, iTerm2, Windows Terminal, Alacritty). Keyboard shortcuts and commands sometimes apply to one but not the other.

For example, Ctrl + L is a Readline shortcut handled by Bash — it tells the shell to redraw the prompt at the top. The terminal emulator itself may also intercept that shortcut and clear its own scroll buffer, depending on how it's configured. This is why the same shortcut behaves differently in iTerm2 versus the default macOS Terminal, or in Alacritty versus GNOME Terminal.

If a shortcut isn't working as expected, the issue is often in the terminal emulator's settings rather than the shell itself.

Variables That Change Which Method Works Best

Several factors determine which clearing method is most appropriate for a given workflow:

  • Shell type — Bash, Zsh, Fish, and PowerShell each handle input differently
  • Terminal emulator — iTerm2, GNOME Terminal, Windows Terminal, and Alacritty have different buffer management features and shortcut configurations
  • Operating system — macOS, Linux distributions, and Windows handle terminal infrastructure at a deeper level differently
  • Whether you need the scroll history preserved — developers debugging often want to scroll up; others want a clean slate
  • Remote sessions — SSH connections to remote servers may limit which escape sequences or shortcuts function reliably

Someone working locally in iTerm2 on macOS has access to Cmd + K, profile-based settings, and robust buffer control. Someone SSH'd into a remote Linux server through a basic terminal may find that only clear and reset behave predictably.

The right technique for clearing terminal input isn't just about knowing the commands — it's about understanding which layer (shell or emulator) you're targeting, and how your specific setup handles each one. ⚙️