Link to home
Start Free TrialLog in
Avatar of wcleung9
wcleung9

asked on

How to print a non-truncated "argument" field for the command "ps"?

I am using JRun on a Solaris platform, and when I us the "ps" command, I found that there are so many java threads running that even exhuasted the system's memory. I want to know what those threads are for. But the output of "ps" is something like below and that makes me unable to know what command and arguments started those threads:


# ps -ef | grep jrun
    root  4204     1  0   Nov 11 ?        0:00 /bin/sh ./jrun start default-app
    root  4501  4204  0   Nov 11 ?        0:21 /opt/jdk1.2.2/bin/../bin/sparc/native_threads/java -classpath=
    root 10654 10024  0 15:30:59 ?        1:12 /opt/jdk1.2.2/bin/../bin/sparc/native_threads/java -classpath=

The "command and arguments" field is truncated. I read the man page of ps and it didn't mentioned how to extend the field width. Anyone know how to do it?

And, in fact I am not sure whether a non-truncated "command and argument" field would give me enough information to know where in my Java program is giving birth to so many threads. I wonder if there is any other command I can use to investigate these threads? I understand that a Java debugger might help me more about this. But I am not the admin of this Solaris server and hence I can't install any extra tools to use.
Avatar of yuzh
yuzh

You can  can use:

ps -e -o pid,ppid,arg

to do the job, "-o" specify" the output format, and what you what to print.

man ps
to learn more
Sorry abou the typo, it should be: (missing a "s")

ps -e -o pid,ppid,args
something must be wrong with my keyboad, missing a "t" for "about"
ASKER CERTIFIED SOLUTION
Avatar of shivsa
shivsa
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wcleung9

ASKER

Sorry that I didn't make any replies for two weeks....

I tried `ps -e -o pid,ppid,args`. But it only specifies what columns are there in the output, and can't specifies the width of each column. The "command and argument" column is still truncated.

Then I tried `/usr/ucb/ps guww`. It can really print out the whole command. But it seems to be different from the normal `ps`...? I can't find the processes I was investigating.....

Finally, I used `truss` and solved my problem. Thx alot shivsa !! But I don't know whether I should accept you answer. Because your answer , though thankfully solved my problem, seems not relevant to the Question Title....I am more than willing to give you the points, but.....I am not familiar with the rules here, should I accept the answer??
We are here to help u with solution, if your problem is solved with my answer than u should accept my answer.
I gave u my answer thinking that it might be obstructing your work, and i gave u quick solution. u may put a comment at the end saying what u feel and close it.

thanks,
shiv
-------------------------------
You can close the question by following this guidelines:

https://www.experts-exchange.com/help.jsp#hs5

"Finally, I used `truss` and solved my problem. Thx alot shivsa !! But I don't know whether I should accept you answer. Because your answer , though thankfully solved my problem, seems not relevant to the Question Title....I am more than willing to give you the points, but.....I am not familiar with the rules here, should I accept the answer??"

Good to hear "truss" solved your problem. You should award the points to shivsa.

It is very often we gave commet seems not relevant to the Question Title, but
can solve the problem. (It depands on the natural of the problem, not the question
title).

Cheers!
Understood. Thx everybody ~~
You can close the question by following this guidelines:

https://www.experts-exchange.com/help.jsp#hs5
sorry for my last comment, i am logging after 2 days and could not see that u already closed the issue.

thanks,
Shiv