What "clearing" means and why you'd do it
Clearing your terminal means removing text from your screen so you can see a fresh workspace. There are two different things you might want to clear: the entire screen (all the commands and output you've run so far), or just the current line you're typing before you press Enter.
You clear the screen when it gets cluttered and hard to read, or when you want to start fresh on a new task. You clear the input line when you've typed something wrong and want to delete it without running the command. Both are quick keyboard shortcuts — no special commands needed.
Clearing is purely visual. Your terminal remembers everything you did, even after you clear the screen. You can scroll back up to see previous output, or use the history command to list every command you ran in this session.
Key Takeaways
- Press Ctrl+L to clear the entire screen on Mac, Linux, or Windows PowerShell — this removes all previous commands and output from view.
- Press Ctrl+U to delete everything you've typed on the current line before you press Enter.
- Press Ctrl+A then Delete to select and remove the entire current line if Ctrl+U doesn't work in your terminal.
- The clear command (type it and press Enter) also clears the screen, but keyboard shortcuts are faster.
- Clearing the screen does not delete your command history — you can still scroll up or use the history command to see what you ran before.
Clear the entire screen with Ctrl+L
The fastest way to clear everything on your screen is to hold Ctrl and press L. This works on Mac, Linux, and Windows PowerShell. Your cursor moves to the top of a blank screen, and all the text above disappears from view.
This does not erase your command history. If you type history (on Mac or Linux) or Get-History (on PowerShell), you'll still see every command you ran before you cleared the screen. Clearing is just visual — it cleans up what you see, not what the terminal remembers.
If you need to see what was on the screen before you cleared it, scroll up with your mouse wheel or trackpad. The output is still there in the terminal's buffer; clearing just moved it off the visible area.
Delete the current line before you press Enter
If you've typed a command wrong and want to erase it without running it, press Ctrl+U. This deletes everything from the cursor to the beginning of the line. Your cursor stays where it is, ready for you to type something new.
If Ctrl+U doesn't work in your terminal (some older systems or custom setups skip it), use Ctrl+A to select the entire line, then press Delete or Backspace. Both methods leave you with a blank line and your cursor ready to type.
Another option is to hold Shift and press Home, then press Delete. This selects from your cursor position back to the start of the line and removes it. Try whichever method works in your terminal first.
Use the clear command if you prefer typing it
Instead of a keyboard shortcut, you can type the word clear and press Enter. This clears the screen the same way Ctrl+L does. It takes longer than the shortcut, but some people find it easier to remember.
On Windows Command Prompt (the older black window, not PowerShell), the command is cls instead of clear. On PowerShell, both clear and cls work and produce the same result.
Undo a cleared screen by scrolling up
If you clear your screen and then realize you needed to see something that was on it, you can usually scroll up with your mouse wheel or trackpad to see the previous output. The text is still there — clearing just moved it off the visible area.
You can also use the history command (Mac and Linux) or Get-History (PowerShell) to list all the commands you've run in this session, even after clearing. This shows you what you typed, though not the full output each command produced.
Some terminals also let you search through history by pressing Ctrl+R and typing part of a command you remember. This is useful when you've cleared the screen and want to find and re-run something you did earlier.
Clearing input on different terminal types
Most modern terminals — Terminal on Mac, GNOME Terminal or Konsole on Linux, and PowerShell on Windows — respond to Ctrl+L and Ctrl+U the same way. If you're using an older system or a custom terminal, these shortcuts might not work.
If Ctrl+L doesn't clear your screen, try the clear command instead. If Ctrl+U doesn't delete your line, try Ctrl+A followed by Delete. Testing these shortcuts takes seconds, and one of them will work in almost any terminal you encounter.
Some specialized terminals (like those in embedded systems or very old Unix machines) might not support these shortcuts at all. In those cases, typing clear or cls is your best option, though even that may not work on extremely limited systems.
Frequently Asked Questions
Does clearing the screen delete my command history?
No. Clearing removes text from your view, but the terminal still remembers every command you ran. Type history (Mac/Linux) or Get-History (PowerShell) to see the full list of commands from this session.
What's the difference between Ctrl+L and the clear command?
They do the same thing — both clear the screen. Ctrl+L is faster because it's a keyboard shortcut. The clear command requires you to type it and press Enter, so it takes longer but works the same way.
Can I clear the screen and keep my cursor at the bottom?
Ctrl+L clears the screen and puts your cursor at the top of the blank area. If you want your cursor at the bottom, press Enter a few times after clearing, or type a command and press Enter to move the cursor down.
What if Ctrl+U doesn't work to delete my line?
Try Ctrl+A to select the entire line, then press Delete or Backspace. If that doesn't work, you can also hold Shift and press Home, then Delete — this selects from your cursor to the start of the line and removes it.
Is there a way to clear the screen and the history at the same time?
Clearing the screen does not erase history. If you want to remove your command history, type history -c (Mac/Linux) or Clear-History (PowerShell). This deletes the history from memory, though some systems keep a file copy on disk that persists between sessions.