[Gllug] Pipes truncating STDOUT to 80 chars

John Edwards John.Edwards at cornerstonelinux.co.uk
Fri Nov 8 17:54:25 UTC 2002


On Fri, Nov 08, 2002 at 01:35:17PM -0000, Rhys Hopkins wrote:
> Does anyone know why RedHat ( in this case specifically Red Hat 7.2 )
> truncates standard output at 80 characters when it is put through a pipe,
> but SuSE ( in this case specifically SuSE 7.0 ) gives you output for the
> full width of your terminal window ?
> 
> This is particularly annoying when doing e.g. 
> 
> # ps -ef | grep httpd
> 
> which works every time in SuSE, but fails every time in RedHat, because the
> standard output from ps -ef is wider than 80 chars, so when piped, the
> command line is truncated, and consequently grep never finds what it is
> looking for.
> 
> What can I change in the RedHat system to make it act like SuSE ?

As far as I know ps only shows 80 characters by design.

You need to include the -w "wide" option:
	ps -efw | grep httpd
for an 132 characters wide, or:
	ps -efww | grep httpd
for all the output, which will line wrap on good terminals.

Debian also has the same behaviour. TFM "man ps" doesn't seem 
have much on the wide option, which is probably the real bug. 


-- 
#------------------------------------------------------------#
|      John Edwards    Email: John.Edwards at uk.com            |
|                                                            |
|     "Security vulnerabilities are here to stay."           |
|   Scott Culp, Manager, Microsoft Security Response Center  |
#------------------------------------------------------------#

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list