10.3: Prevent Terminal from clearing screen after commands

Nov 05, '03 10:54:00AM

Contributed by: EatingPie

With the new Terminal, certain UNIX commands (vi, less, man, etc.) cause the window to clear when they're done. I personally found this annoying. I typically do a man or a less, then want to copy/paste some info, such as command line parameters, into the same window. One particularly frustrating behavior occurs if you do an less -F on a tiny file. In this case, less exits if the entire file fits on the screen ... but then the screen clears. D'oh!!

Fortunately, this behaviour can actually be defeated quite easily! Simply edit your Terminal -> Preferences and change "Declare Terminal Type ($TERM) as:" to "vt100" and close the window. Only new Terminal windows will pick this up.

Both Apple's supplied /bin/ls and emacs syntax colorized highlighting work great with vt100 and color. And no annoying (well to me anyway) clear-screens at the end of a command! One caveat is that if you use GNU's ls, you MAY have to change the .dircolorsrc in your home directory. Most vt100 terminals do not support color, so you need to tell GNU ls that yours does. Simply add the following line:

TERM vt100
And you're set!

[robg adds: Thank you! That was so annoying I had taken to opening two windows, one with man and the other with what I was actually working on. I figured it was probably a simple fix, I just didn't think it would be THAT simple!]

Comments (31)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20031031185759986