Originally posted by Ben Cramphorn:
A way to clear the screen would be cool
Ben Cramphorn wrote:Thank you and apologies for the late reply.
Tim Holloway wrote:If that isn't a record, I'd like to know what is!
A lot of devices will honor a "Control-L" character code. I believe that hex 0C. Its official ASCII name is "form feed", and on compliant text printers, it initiates a page eject operation. Which is the paper equivalent of clearing the screen and going to the top, so a lot of "glass TTY" monitors adopted CTL-L as a clear-screen convention as well. With the advent of window-based GUI systems, virtual terminals became popular and true to their name, they mimicked the behavior of their corresponding physical terminals.
Older terminal apps usually allowed you to configure to emulate specific popular physical terminals, such as the DEC VT-100 terminal. A quick look at my desktop seems to indicate that these days, the virtual terminals are more generic and abstract.
There are common escape sequences for positioning the text cursor, blanking, color and intensity and so forth. The Unix/Linux curses package was created to translate them to hardware-specific command sequences so that portable "text gui" apps could be written. That was useful back before servers commonly ran with windowing systems. And frankly, I'm not keen on the trend that servers should be required to be running high-resolution graphics/window systems anyway, I do most of my administration from a remote console so having all that overhead on the server is mostly just an annoyance that prevents me from recycling older monitors and video cards.
So, if you're brave, I recommend outputting a CTRL-L and buffer flush. It will work in an awful lot of cases, but not all of them. If full portability is essential, then you need to be working with a graphics manager and issuing graphics API commands.