Piping PS truncates lines?

  • Follow


I noticed that if I try something like:

   ps -ux | sort -rk 3 | head -n 25

or

   ps f -e | grep perl

I get back the correct lines, but they are always truncated to 80 lines?

It seems to me that this is the doing of the ps command (if it thinks
it's being piped?)

Is there any way to force it to give full lines?

Thanks for any help.


0
Reply Wally 11/25/2003 9:08:41 PM

On Tue, 25 Nov 2003 13:08:41 -0800, Wally Sanford wrote:
> I noticed that if I try something like:
> 
>    ps -ux | sort -rk 3 | head -n 25
> 
> or
> 
>    ps f -e | grep perl
> 
> I get back the correct lines, but they are always truncated to 80 lines?
> 
> It seems to me that this is the doing of the ps command (if it thinks
> it's being piped?)
> 
> Is there any way to force it to give full lines?

I wonder if your  ps man page might have something about wide output
try     man ps
0
Reply Bit 11/25/2003 9:42:19 PM


"Wally Sanford" <wsanford@wallysanford.com> writes:

> I noticed that if I try something like:
>
>    ps -ux | sort -rk 3 | head -n 25
>
> or
>
>    ps f -e | grep perl
>
> I get back the correct lines, but they are always truncated to 80 lines?
>
> It seems to me that this is the doing of the ps command (if it thinks
> it's being piped?)
>
> Is there any way to force it to give full lines?

You don't say what flavor of Unix you're using, but it's usually
possible to force ps to print wide lines.  See the manual page for
ps ("man ps") to find out how.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/
0
Reply mfuhr 11/25/2003 10:03:14 PM

On Tue, 25 Nov 2003 at 21:08 GMT, Wally Sanford wrote:
> I noticed that if I try something like:
> 
>    ps -ux | sort -rk 3 | head -n 25
> 
> or
> 
>    ps f -e | grep perl
> 
> I get back the correct lines, but they are always truncated to 80 lines?
 
     I think you mean "80 columns".

> It seems to me that this is the doing of the ps command (if it thinks
> it's being piped?)

     Do you get long lines when using ps by itself? I doubt it.

> Is there any way to force it to give full lines?

man ps

     Look for -w.

-- 
    Chris F.A. Johnson                        http://cfaj.freeshell.org
    ===================================================================
    My code (if any) in this post is copyright 2003, Chris F.A. Johnson
    and may be copied under the terms of the GNU General Public License
0
Reply Chris 11/25/2003 10:53:27 PM

Michael Fuhr wrote:
> "Wally Sanford" <wsanford@wallysanford.com> writes:
>
>> I noticed that if I try something like:
>>
>>    ps -ux | sort -rk 3 | head -n 25
>>
>> or
>>
>>    ps f -e | grep perl
>>
>> I get back the correct lines, but they are always truncated to 80
>> lines?
>>
>> It seems to me that this is the doing of the ps command (if it thinks
>> it's being piped?)
>>
>> Is there any way to force it to give full lines?
>
> You don't say what flavor of Unix you're using, but it's usually
> possible to force ps to print wide lines.  See the manual page for
> ps ("man ps") to find out how.

It says nothing about cols or wide lines, thats why I asked :(

It looks like a FreeBSD box but I dont seem to have permission to run
uname (I dont own the box.)

Could you please just say what the proper args are, as there seem to be
some (but I keep getting reffered to the man pages which seem to be
incomplete on this box - its the first place I always look.)


0
Reply Wally 11/25/2003 10:56:07 PM

Chris F.A. Johnson wrote:
> On Tue, 25 Nov 2003 at 21:08 GMT, Wally Sanford wrote:
>> I noticed that if I try something like:
>>
>>    ps -ux | sort -rk 3 | head -n 25
>>
>> or
>>
>>    ps f -e | grep perl
>>
>> I get back the correct lines, but they are always truncated to 80
>> lines?
>
>      I think you mean "80 columns".

Thanks my boo-boo ;p

>> It seems to me that this is the doing of the ps command (if it thinks
>> it's being piped?)
>
>      Do you get long lines when using ps by itself? I doubt it.

No only when piped.

>> Is there any way to force it to give full lines?
>
> man ps
>
>      Look for -w.

Thank you.


0
Reply Wally 11/25/2003 10:57:18 PM

In article <bq0mmd$1tsjav$1@ID-196529.news.uni-berlin.de>, Wally Sanford wrote:
[snip: ps -w]
> 
> It looks like a FreeBSD box but I dont seem to have permission to run
> uname (I dont own the box.)

Then... you could always ask the owner. Or look at the login banner.
Or check dmesg, if you have permission to run that.


> Could you please just say what the proper args are, as there seem to be
> some (but I keep getting reffered to the man pages which seem to be
> incomplete on this box - its the first place I always look.)

  http://www.freebsd.org/cgi/man.cgi

FreeBSD has its manual pages (and those for quite a few others as well)
online. A few other projects (NetBSD, I think) have theirs online as well.


-- 
  j p d (at) d s b (dot) t u d e l f t (dot) n l .
0
Reply jpd 11/26/2003 9:20:19 AM

6 Replies
257 Views

(page loaded in 0.117 seconds)


Reply: