Clear Screen Script


Handy to have around because it shows how to use printable escape sequences from shell scripts...

    #!/bin/ksh
    #
    #  cls - clear screen and reset all (vt100+compatible)
    #
    #  ESC = control-[ = octal 033
    #  CSI = ESC + [
    #
    #  CSI + ?3l = set screen width 80 (?3h=width 132)
    #  CSI + ?5l = set normal video (light chars on dark bkgd)
    #  CSI + 0m  = turn off blink, bold, underline, etc
    #  CSI + 2J  = clear entire screen, turn off double height/width
    #  CSI + H   = home cursor
    #
    echo "\033[?3l\033[?5l\033[0m\033[2J\033[H"


keywords: escape sequences
date: 03/20/2006