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?

  • What terminal are you using that resizing doesn't work? – Chris S Oct 6 '10 at 15:40
  • I currently use MacOS X+Terminal, verified on Ubuntu 10.04+lxterminal and Windows 7+Putty, the very same result everywhere. – Yorik.sar Oct 6 '10 at 23:50

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).


Not sure about tcsh, but for bash, sh and ksh:

eval `resize`

Should do the trick.


The resize script comes with xterm which you can install from ports (although you will get libX11 etc with it).


tcsh inherits the environment from the parent shell. To add additional envvars you can:

source envvar

where envvar contains for example:

set history = 5000
# Set save history
set savehist = 5000
# Set a prompt
set prompt = `whoami`%' '
# Add to the default exported $PATH from the parent shell.
set path = `echo $path ~/bin`
# Create a new environment variable
set newShellVar = whatEver

Once you enter the shell, e.g. type tcsh <return> you can activate the file using:

source envvar

Of course if you name your envvar file as ~/.tcshrc, then the file is auto sourced when you execute the tcsh command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.