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-Hostor its aliascls - Ctrl + L also works in some modern Windows Terminal configurations
| Environment | Screen Clear Command | Keyboard Shortcut |
|---|---|---|
| Bash / Zsh (Linux/macOS) | clear | Ctrl + L |
| Fish Shell | clear | Ctrl + L |
| Windows CMD | cls | — |
| PowerShell | Clear-Host / cls | Ctrl + 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
resetreinitializes the terminal and clears the buffer more aggressively thanclear - Some terminal emulators have a "Reset and Clear" option in their Edit or View menus
- Ctrl + L only clears the visible portion;
resetgoes further
Using an escape sequence directly:
printf ' 33[2J 33[3J 33[H' This sequence clears the screen (