FreeBSD tcsh and terminal window size

command-line-interfaceenvironment-variablesfreebsdterminal

When I'm working on my FreeBSD server's ssh, it always assume that terminal width is 80 columns. E.g. man pages show up in one thin column and all programs that use COLUMNS and LINES environment variables to guess terminal size work only in 80 default columns.

Are there any way to make tcsh correctly set this environment vars and send them to child programs?

Best Answer

sh: unset COLUMNS LINES; export TERM=xterm

csh: unsetenv COLUMNS LINES; setenv TERM xterm

Terminals which have dynamic size or font or resolution are the norm, not the exception.

When that became the case, Unix put this information into the kernel tty attributes, and deprecated $COLUMNS, $LINES, and the termcap/terminfo dimension data.

You can see the kernel dims by running "stty -a". Ssh, rlogin, and modern telnet pass these dimensions to the remote side.

Usually, unsetting elicits better behavior. Sometimes, a shell will reset the env vars (based on "stty" info).