5

I have just installed the latest stable version of FreeBSD to a computer and I have the following problem:

If, in Putty, I issue a command like ps uxa which gives long lines of output, they get cropped. ps uxa|more doesn't help. Even if I do ps uxa > file.txt, lines are cropped to 80 chars in the file!

There are some images of how it looks like: http://yfrog.com/0rfilecroppx

This happens right after clean installation, with everything set to default. Default shell is csh, changing it to bash didn't help. This has never happened to me in Linux.

My uname -a

FreeBSD freebsd.localdomain 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Sat Nov 21 15:48:17 UTC 2009
root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386

How to fix this problem? I have already looked at env vars, .profile, .cshrc, /etc/login.conf.

2 Answers2

2

Try using the -w option:

From the MAN page:

 -w      Use 132 columns to display information, instead of the default which is your
         window size.  If the -w option is specified more than once, ps will use as
         many columns as necessary without regard for your window size.  When output
         is not to a terminal, an unlimited number of columns are always used.
einstiien
  • 2,538
  • 18
  • 18
  • Thanks einstiien, but it doesn't solve the problem. This cropping happens with ANY command, ps is just an example. And the most irritating thing is that when I output the result of a command to a file, the lines still get cropped (it is seen at the picture)! Maybe, there's something wrong with the xterm or shell configuration. – skrostislav Feb 05 '10 at 19:30
  • hmm, I just tested this on my FreeBSD 7.0 box and when I run it with the `-w` command the lines wrap instead of getting cut off. I am connecting from MacOS X terminal with my emulation set as VT100 (because of some of the older servers I connect to). It might be an emulation issue. Try VT100. I'll play around with putty on a windows box and see what I can come up with. – einstiien Feb 05 '10 at 19:36
  • Ok, it works for me through putty with the default putty settings. My freebsd box has $TERM=xterm. I know you said FreeBSD was default but did you change any of the settings in putty? – einstiien Feb 05 '10 at 20:25
  • This is just the way BSD ps works (same on open and net as well) - no -w's gets you 80 column, one -w gets you 132, -ww gets you unlimited. It does not matter if the output is redirected to a file. http://unix.derkeiler.com/Mailing-Lists/FreeBSD/questions/2004-10/3029.html – quadruplebucky Mar 04 '10 at 18:06
1

This is a feature/bug of putty, not FreeBSD. putty always tells the other OS what its width and height are. You can show this easily by doing one of your truncating ps commands, then widen the putty screen. You can see that the lines were truncated. Now give the ps comand again: you will see more columns.

In essence, what you are asking putty to do is to lie about the width of your window (giving a number larger than what it really is showing) and to wrap the longer lines intelligently. That will work fine for ps and ls -l and so on, and fail miserably for vi or any other full-screen editor. Such lying can also cause display of information that can be misinterpreted because of the wrapping. There may be a mode of putty that does this, but I could not find it.

Paul Hoffman
  • 2,094
  • 4
  • 18
  • 23