MacOS – Completely clear all output from a Terminal window

command linemacosterminal

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?

Best Answer

Have you tried the clear all combination +K?

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