đź§ą Command: clear (Clear Terminal Screen)
The clear command does exactly what its name suggests: it wipes the terminal screen of all previous commands and output, giving you a fresh, clean workspace.
1. The "Why"
When you’ve been deep in a session—debugging Java code for Project, running long grep searches, or checking pacman updates—the terminal window becomes cluttered. This "visual noise" makes it hard to focus on the next task.
clear is the "reset button" for your eyes. It doesn't delete your command history or stop any running processes; it simply scrolls the previous text out of view.
2. Basic Syntax
clear
That’s it. No complicated arguments are usually needed.
3. How it Works (The "Scrollback" Secret)
It is important to know that clear doesn't actually "erase" the data. On most modern terminal emulators (like the ones you likely use with Hyprland or GNOME), it simply pushes the old text upward.
- To see old work: Just scroll up with your mouse or keyboard.
- To truly "wipe" everything: Some systems use
reset, which re-initializes the terminal entirely (useful if the screen gets garbled by binary data).
4. Practical Shortcuts
Since clear is used so often, most Linux users don't even type the word. They use the universal keyboard shortcut:
Ctrl + L- This works in almost every Linux shell (Bash, Zsh). It’s faster and keeps your hands in the typing position.
5. Pro-Tips
- The "Clean Start" Alias: If you like your terminal to show a bit of system info every time you clear it, you can alias it in your
.bashrc:alias cls='clear && neofetch' - Clearing the Scrollback: If you are working with sensitive info (like passwords or private data) and want to make sure it's completely gone from the scrollback buffer, some terminals support:
clear && printf '\e[3J' - Arch Linux Context: You’ll find yourself hitting
Ctrl + Lconstantly between steps of a manual Arch configuration to keep track of where you are in a tutorial.
6. Summary Reference
| Goal | Action |
|---|---|
| Clear the screen (Command) | clear |
| Clear the screen (Shortcut) | Ctrl + L |
| Deep Reset (Fix garbled text) | reset |