Read full article in WebMediums
How to delete the previous output in Terminal in Mac OS X
Most people know the clear command that "cleans" the current screen, but it does so by simply printing many new lines: the content that is erased only moves up.
In a few words it does not clean the console.
Is there any way to completely erase all the previous outputs of the terminal so that I can not reach them even by moving upwards?
The answer is yes
You only have to write the following command in the console and everything that has been written in that session will be erased and will be completely clean.
clear && printf '\e[3J'
Writing the above command will be completely clean the console.