December 30, 2019
When a terminal window gets busy, sometimes, it’s nice to make a little breathing so that it’s easier to see what’s going on.
There are a few different ways to do this:
This is the easiest solution. When the terminal window gets full, just press enter or
CTRL (⌃) + C (exiting the process, even if there is not one running), until the previous print out is above the fold.
There are many useful keyboard shortcuts for the terminal on MacOS (which work in iTerm2 as well).
In this case, two that are particularly useful are:
CMD (⌘) + K)
CMD (⌘) + L)
For a long time, “Clear to start” has been my go to. It is like opening a brand new terminal but without losing any of the context.
When I watch other people work - whether they’re colleagues or instructors for a course I’m taking - I am always surprised by the prevalent use of the
In the UNIX tradition, it does one thing. From the manual page:
NAME clear - clear the terminal screen
DESCRIPTION clear clears your screen if this is possible. It looks in the environ- ment for the terminal type and then in the terminfo database to figure out how to clear the screen.
clear ignores any command-line parameters that may be present.
SEE ALSO tput(1), terminfo(5)
This describes ncurses version 5.7 (patch 20081102).
I decided to try
clear and found I actually prefer it. Why? Because while it does provide the same clean terminal feel as “Clear to start”, it does so without clearing history.
As a result, when running clear, I can “scroll up” to see the previous logs.
Not losing history in the event that I may need it seems like a benefit worth paying with three extra characters.
Thanks for reading! My name's Stephen Weiss. I live in Chicago with my wife, Kate, and dog, Finn.
Click here to see the archives of my weeks in review and sign up yourself!