How to delete the previous output in Terminal in Mac OS X

Johan
Johan
1 min read

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'
How to delete the previous output in Terminal in Mac OS X – How To

Writing the above command will be completely clean the console.

Responses