?
Solved

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

Posted on 2003-11-12
11
Medium Priority
?
561 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 24

Accepted Solution

by:
shivsa earned 500 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 21

Expert Comment

by:tfewster
ID: 9740122
0
 

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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
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.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses
Course of the Month15 days, 16 hours left to enroll

743 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