Output of running berkeley ps is truncated to 80 chars when using redirections.
$ /usr/ucb/ps -e 12490|cat #truncated to 80 chars
PID TT S TIME COMMAND
12490 pts/24 S 0:00 sleep 4000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
getting longer lines is done by changing the stty
$ stty columns 300
$ /usr/ucb/ps -e 12490
PID TT S TIME COMMAND
12490 pts/24 S 0:00 sleep 4000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...#line is 300 char
when running with redirection and trying to get the same result by environment variables
$ set COLUMNS=300;export COLUMNS
$ echo $COLUMNS
300
$ /usr/ucb/ps -e 12490|cat #truncated to 80 chars
PID TT S TIME COMMAND
12490 pts/24 S 0:00 sleep 4000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
another option i tried is by setting the output in a variable (still not working):
$output=`/usr/ucb/ps -e 12490`
$echo $output
PID TT S TIME COMMAND
12490 pts/24 S 0:00 sleep 4000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Does some knows how to overcome this problem?
How can i know what is the max size the stty columns can be define?
I have noticed that setting the stty columns higher the the length of the command and arguments (ps -e) the ps "command" line shows only the process name in brackets e.g. [java].
Thats why i am looking for the max size of the command and args.
Maybe you should try reading the man page? It has stuff like:
"w Use a wide output format (132 columns rather than 80); if repeated, that is, -ww, use arbitrarily wide output. This information is used to decide how much of long commands to print."
what is your configuration of the stty [columns] (stty -a)?
what happens if you set the stty columns size bigger the the command line? does the command comes with brackets? Do you know if there is a way to avoid that?
Is there any COLUMNS environment variable defined?
My column size is 80 and there is no environment variable setting it to something different. However, ps auxwww still shows me the entire command line of the process. (Whats a very useful feature when having a look at java processes ;-))
Did you ever try ps auxwww (with 3 w) ? This should work regardless of any column size settings when using the /usr/ucb/ps exec, afaik.