I would like to clear all output from a Terminal window (including all historical output) to get it back to a clean state as if you had just opened a new Terminal window, or a new Terminal tab.

I can use the clear command to clear just the current screenful, but then you can still scroll up to see all the historical output. I'm using the Terminal to trace program output and at the end I would just like to do + A to select all the text so I can grab the output from the just last run, without having to scroll up and see where it started. I could also just open a new tab, I was just wondering if this can be done in the same window?

3 Answers 3


Have you tried the clear all combination +K?

There is also ++K, which just clears the scroll-back.


The combination +L will clear the output of last command in mac default terminal zsh.

this way you can keep pressing for as much cleaning you want to do


There is an alternative way to do this in your shell: in bash you can use Ctrl+Meta(Option)+L to clear all scrollback and screen("clear-display"). zsh however by default does not clear scrollback when you press this(it invokes "clear-screen" just like Ctrl+L). It uses the escape sequence \e[H\e[2J\e[3J if you are interested.(cat this to your other ttys will clear them remotely!)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .