3 ms·
Ask HN: Why doesn't 'clear' actually erase the console?
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?
- franciscogarcia 12y agoI always thought it just printed empty lines based on window height. So when you scrolled up, stuff was still there.
- koolkat 12y agoYes. 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.
- koolkat 12y agoThis code works on my terminal: \e[1;1H\e[2J So try printf "\e[1;1H\e[2J"