

Ask HN: Why doesn't 'clear' actually erase the console? - bikamonki

If I run clear on a re-sized console window in Linux all goes away but when I maximize that window everything is there, clear just scrolls console contents?
======
koolkat
Yes. I think its a special code that the program sends to the terminal. It
comes from the days terminals used to be fisical instead of virtual. Its in
the termcap database that corresponds to the terminal you use.

------
franciscogarcia
I always thought it just printed empty lines based on window height. So when
you scrolled up, stuff was still there.

------
koolkat
This code works on my terminal: \e[1;1H\e[2J So try printf "\e[1;1H\e[2J"

