Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm connecting to my Linux boxes (primarily Debian Squeeze) using Putty for Windows. Whenever I run a 'less' command, e.g. on an aptitude search, less truncates the listing to much less than my window size. I've looked to see how I can override this but haven't come up with anything.

BTW - I'm not a Linux n00b, but have just noticed this and it's really starting to irritate me :)

share|improve this question
up vote 1 down vote accepted

What terminal is putty reporting to your linux boxes? echo $TERM to find out. You might try setting this to xterm-color (can be set in the putty session configs) for best results. Several character and behavior issues get straightened out when it thinks you have a capable terminal.

share|improve this answer
I'll have to check that when I get back to my office tomorrow. I'll keep you posted. – Larry G. Wapnitsky Apr 17 '11 at 19:05

Are you sure it's less doing the truncation and not aptitude? I notice that aptitude truncates to 80 columns by default when you redirect its output. Try aptitude search foo | cat and see if your output is truncated.

When you filter the output of a command, it's debatable whether it's best to truncate at the terminal width, at 80 columns or not at all. In fact the command can't know whether its output is eventually going to the terminal, so truncating to the terminal width is dubious.

You can run aptitude --disable-columns to make aptitude not truncate at all, but it won't align its output either. If your shell is bash or zsh, you can obtain the terminal width from the COLUMNS shell variable and pass it to aptitude:

aptitude -w $COLUMNS search foo |less
share|improve this answer
that's the exact thing. Passing $COLUMNS bypasses the issue (even locally). --disable-columns is too messy to look at. Time to create more aliases :) – Larry G. Wapnitsky Apr 17 '11 at 19:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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