Friday, July 04, 2008

AWK tricks - clearing the screen and scrollback buffer.

You can put this in your logout profile to fill up the screen buffer (clear just won't do on some systems with a multiple page console scroll-back buffer).

Filling the screen buffer with new lines:

awk -F 'BEGIN{ for (i = 1; i <= 3000; i++) printf "\n"; exit}'

See also:

http://www.openbsd.org/faq/faq7.html#ConsoleClear

1 comment:

  1. Anonymous1:37 AM

    had to change -F to -F:

    This works great for clearing out gnu screen scrollback buffer.

    Thanks for the tip!

    ReplyDelete