2

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.

1

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.

  • 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
4

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
  • 1
    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 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.