When working extensively in the Ubuntu Linux terminal, your screen can quickly become cluttered with the output of previous commands, error logs, and directory listings. A messy terminal makes it difficult to focus on your current task and can cause you to accidentally misread old output as new information. Knowing how to quickly wipe the screen clean is one of the most fundamental quality-of-life skills for any Linux user or system administrator.
The Standard Method: The Clear Command
The most universal and explicit way to empty your terminal window is by using the dedicated clear command.
- Ensure your cursor is active on the command line prompt.
- Type the word
clear. - Press Enter.
The terminal will immediately push all existing text upwards, presenting you with a completely blank screen and a fresh command prompt at the very top left corner.
The Faster Method: Keyboard Shortcuts
Typing “clear” every few minutes can interrupt your workflow. Professional system administrators almost exclusively use the built-in keyboard shortcut to achieve the exact same result instantly.
While working in the terminal, simply press Ctrl + L.
This shortcut executes the clear function immediately, without requiring you to type a command or press Enter. It even works if you are in the middle of typing a long command string; the screen will clear, and the half-typed command will remain on the new, clean prompt line.
Understanding What Actually Happens
It is important to understand that neither clear nor Ctrl + L actually deletes your command history or the previous output from the system’s memory. They simply add enough blank lines to push the old text off the top edge of your visible window.
If you realize you need to see the output of a command you just cleared, you can easily retrieve it:
- Simply use your mouse wheel to scroll up.
- Use the scrollbar on the right side of the terminal window.
- Press Shift + Page Up on your keyboard to scroll back through the buffer.
How to Hard Reset the Terminal
In rare situations, a command might output corrupt binary data or strange escape characters that completely break your terminal’s formatting, causing your text to appear as gibberish or symbols. In this scenario, simply pushing the text off the screen will not fix the underlying formatting corruption.
To perform a complete “hard reset” that clears the screen and reinitializes the terminal’s text rendering engine, type the following command:
reset
Press Enter. The screen will clear, and the terminal environment will be completely restored to its default state.