How to Use the macOS Terminal Clear Command and Keyboard Shortcuts

Working in the macOS Terminal application often results in a cluttered, chaotic screen. After running several diagnostic commands, compiling software, or reading lengthy log files, your terminal window will be completely filled with hundreds of lines of text. This visual noise makes it difficult to focus on the output of your next command, especially if you need to take a clean screenshot of the terminal for troubleshooting purposes. Fortunately, macOS provides simple ways to wipe the terminal screen clean and start fresh without needing to close the application and open a new session.

Using the Clear Command

The standard, universal method for clearing a UNIX-based terminal (which macOS is built upon) is the clear command.

  1. Ensure your terminal prompt is ready and waiting for input. (If a command is currently running and generating output, press Ctrl+C to terminate it first).
  2. Type the word clear and press Enter.

The terminal will instantly wipe away all previous output, placing your fresh command prompt at the very top of the window.

Note on Scrollback: It is important to understand that the clear command does not actually delete your previous output; it simply inserts enough blank lines to push the old text up and out of the visible window. If you scroll up using your mouse or trackpad, you will still see all the old commands you ran previously.

Using the Keyboard Shortcut (Control + L)

If you find yourself clearing the screen frequently, typing the word “clear” over and over is inefficient. The bash and zsh shells (the default command-line interpreters in macOS) include a built-in keyboard shortcut.

  • Simply press and hold the Control key and press the letter L (Ctrl+L).

This shortcut executes the exact same function as the clear command, instantly pushing the previous output out of view and returning your prompt to the top line. This is universally preferred by system administrators because it is faster and doesn’t clutter your shell’s history file with endless entries of the word “clear”.

How to Hard Reset the Terminal

Sometimes, a standard clear is not enough. If you accidentally cat a binary file to the screen, it can corrupt your terminal’s character encoding, replacing your standard text with strange symbols and making the terminal completely unusable. In this scenario, pushing the bad text up out of the window won’t fix the underlying corruption.

To perform a “hard reset” that clears the screen and re-initializes the terminal emulator:

  1. Type the command reset and press Enter. (Even if the text you type looks like gibberish on the screen, trust that the shell is receiving the correct keystrokes).
  2. The terminal may pause for a second, the screen will flash, and a perfectly clean, uncorrupted prompt will be restored.

If you prefer a macOS-specific keyboard shortcut to completely purge the scrollback buffer (so you cannot scroll up to see old commands at all), press Command + K. This is highly useful when you are about to take a screenshot and want to ensure no sensitive previous output can be scrolled into view.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.