Unix administration - Piping PS truncates lines?

This is Interesting: Free IT Magazines  
Home > Archive > Unix administration > January 2004 > Piping PS truncates lines?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Piping PS truncates lines?
Wally Sanford

2004-01-23, 4:54 pm

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.


Bit Twister

2004-01-23, 4:54 pm

On Tue, 25 Nov 2003 13:08:41 -0800, Wally Sanford wrote:
quote:

> 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
Michael Fuhr

2004-01-23, 4:54 pm

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

> 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/
Chris F.A. Johnson

2004-01-23, 4:54 pm

On Tue, 25 Nov 2003 at 21:08 GMT, Wally Sanford wrote:
quote:

> 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".
quote:

> 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.
quote:

> 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
Wally Sanford

2004-01-23, 4:54 pm

Michael Fuhr wrote:
quote:

> "Wally Sanford" <wsanford@wallysanford.com> writes:
>
>
> 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.)


Wally Sanford

2004-01-23, 4:54 pm

Chris F.A. Johnson wrote:
quote:

> On Tue, 25 Nov 2003 at 21:08 GMT, Wally Sanford wrote:
>
> I think you mean "80 columns".



Thanks my boo-boo ;p
quote:

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



No only when piped.
quote:

>
> man ps
>
> Look for -w.



Thank you.


jpd

2004-01-23, 4:54 pm

In article <bq0mmd$1tsjav$1@ID-196529.news.uni-berlin.de>, Wally Sanford wrote:
[snip: ps -w]
quote:

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

quote:

> 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 .
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com