Solved

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

Posted on 2003-11-12
11
550 Views
Last Modified: 2013-12-27
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.
0
Comment
Question by:wcleung9
  • 4
  • 4
  • 2
  • +1
11 Comments
 
LVL 38

Expert Comment

by:yuzh
ID: 9736966
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
0
 
LVL 38

Expert Comment

by:yuzh
ID: 9737023
Sorry abou the typo, it should be: (missing a "s")

ps -e -o pid,ppid,args
0
 
LVL 38

Expert Comment

by:yuzh
ID: 9737033
something must be wrong with my keyboad, missing a "t" for "about"
0
 
LVL 24

Accepted Solution

by:
shivsa earned 125 total points
ID: 9737204
u can use truss to see what is your program doin.

truss -p <pid of your java program>.

this will keep running your program and if program forks child and all it will keep track of those.
please do man truss for more info.
0
 
LVL 20

Expert Comment

by:tfewster
ID: 9740122
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:wcleung9
ID: 9822798
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??
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9822807
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:

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

0
 
LVL 38

Expert Comment

by:yuzh
ID: 9824907
"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!
0
 

Author Comment

by:wcleung9
ID: 9847675
Understood. Thx everybody ~~
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9864611
You can close the question by following this guidelines:

http://www.experts-exchange.com/help.jsp#hs5
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9864918
sorry for my last comment, i am logging after 2 days and could not see that u already closed the issue.

thanks,
Shiv
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now