When using Terminal.app, you can clear the screen by using the shell builtin clear
or by pressing ^+L (Control-L).
However, all this does is push the current screen content back one screen height and reset the cursor/input at the first line. Meaning you can still scroll back and see it.
What you are also able to do, is reset your entire scrollback by pressing ⌘+K (Command-K).
After you've done this, you cannot scroll back at all.
In certain situations (notably, before running screen
or vim
), I'd like to reset the scroll back before the command actually executes.
Is there a command (like clear
) that is implemented in OS X that allows me to do this? Given the existence of pbcopy
and pbpaste
, I'm thinking something similar might exist that will allow me to do this.
clear && printf '\e[3J'
(You have selected the wrong answer as correct answer!) – Cyborg Aug 23 '17 at 18:39