How do I clear the screen in Terminal (no CLS)

I'm just beginning, and I want to learn how to clear the terminal window screen. I thought the command was CLS, but this isn't a known command, so the result is
zsh: command not found: cls

Also, it's not mentioned in the Command Line Primer

Surely it's possible to access this, but how?
Post not yet marked as solved Up vote post of jerelo Down vote post of jerelo
15k views
  • in my mac terminal i can't clear the screen with command clear. any suggestions would be utterly welcomed.

Add a Comment

Replies

cls is for Windows Command Prompt. For *nix-based systems like macOS, use the command clear.

If you're using the built-in Terminal app:
  • Edit > Clear Scrollback ⌥⌘K (Alt+Cmd+K)

  • Edit > Clear Screen ⌃⌘L (Ctrl+Cmd+L)

If you're using iTerm:
  • Edit > Clear Buffer ⌘K (Cmd+K)

  • Edit > Clear Scrollback Buffer ⇧⌘K (Shift+Cmd+K)

Personally, I prefer the menu options over the clear command because the command doesn't clear the scrollback buffer (since it has no knowledge of the scrollback buffer).
Thanks jpickwell, I appreciate you taking the time to help, and your answer is clear and informative.
  • Thanks this has helped me, I appreciate your time and effort one more again thank for your clear answer sir

Add a Comment

The default Terminal app on Mac shows these options in its menu.

In short, use CMD+K.

Open Edit and see:

As of Feb 2023.

"clear" should work.

  • just "clear" in place of "cls".

Add a Comment