Solved

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

Posted on 2003-11-12
11
546 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
Comment Utility
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
Comment Utility
Sorry abou the typo, it should be: (missing a "s")

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

Expert Comment

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

Accepted Solution

by:
shivsa earned 125 total points
Comment Utility
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
Comment Utility
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:wcleung9
Comment Utility
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
Comment Utility
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
Comment Utility
"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
Comment Utility
Understood. Thx everybody ~~
0
 
LVL 24

Expert Comment

by:shivsa
Comment Utility
You can close the question by following this guidelines:

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

Expert Comment

by:shivsa
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
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…
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.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now