Mac Terminal is a powerful tool that allows you to interact with your system using text-based commands. Whether you're a developer, sysadmin, or casual user running occasional scripts, you might find your Terminal window getting cluttered with old outputs. That's where the clear command comes in.
This article explains what the clear command does in the macOS Terminal, how to use it, and how to clear both the screen and command history for a clean slate.
What does clear mean in Terminal?
In the context of Terminal, "clear" refers to removing visible content from the screen or erasing the command history saved in your shell session. It's important to understand the difference:
- Clearing the screen: This only hides previous outputs—it doesn't actually delete them from the system or history.
- Clearing the history: This removes saved command inputs, which can be useful for privacy or troubleshooting.
Common clear Terminal commands on Mac
Here are the most frequently used commands to clear the Terminal on macOS:
Command | Purpose |
clear | Clears the visible screen output |
Command + K | Shortcut to clear the screen in Terminal.app |
reset | Resets the Terminal session completely |
history -c | Clears history (for bash shell) |
fc -R | Reloads history from saved file |
rm ~/.zsh_history | Deletes zsh command history file |
Note: macOS uses the zsh shell by default since macOS Catalina, so bash-specific commands may not work unless you've switched shells.
How to use the clear command on Mac?
Follow the detailed steps to use clear Terminal commands on Mac:
- Finder > Applications > Utilities > Terminal.
- Type "clear" and press the Enter key.
(This instantly wipes the visible screen content but doesn't erase history.) - Alternatively, press Command + K: This shortcut works only in the default Terminal app and offers the same effect as clear.
This is useful when you want a cleaner view but don't want to lose your previous commands.
How to clear Terminal screen and history on Mac
If you wanna go beyond just clearing the screen and actually remove your command history, use these to clear Terminal history on Mac:
# Clear command history in zsh
- Use "rm ~/.zsh_history" in the default shell zsh on Mac.
- Then reload the shell: "exec zsh".
# Clear history in bash
- Type "history -c" in bash(older Macs or manually switched shells).
- Or choose the optional one: history -w.
The clear command and related tools are essential for maintaining a clutter-free Terminal environment on your Mac. Whether you want to clean up the display, protect your privacy, or simply start fresh, knowing how to clear the screen and command history gives you more control over your workflow.
Remember: clear only hides previous outputs, while deleting history requires specific commands like rm ~/.zsh_history or history -c.
For anyone using Terminal regularly, these quick tips will keep your workspace neat and secure. Have you got what is clear Terminal commands on Mac? Please share our post.