Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to run command "/usr/ucb/ps auxww" on solaris to extract SZ and RSS values. For some processes these values are not showing and mixing with %MEM value as shown below.

USER       PID %CPU %MEM   SZ  RSS TT       S    START  TIME COMMAND
root         3  0.1  0.0    0    0 ?        S   Feb 08 3395:09 fsflush
root      6589  0.1  0.15985621000 ?        S   Feb 08 1309:24 ./ssmagent.bin -
root      7232  0.0  0.0 3912 3344 pts/7    O 12:55:34  0:00 /usr/ucb/ps -auxww

If you see here, for PID 6589 there is no seperate SZ and RSS values, I am not sure these are mixed in %MEM.

Is there anyway I can mention fixed width for each column?

share|improve this question

migrated from stackoverflow.com Jul 5 '10 at 7:24

This question came from our site for professional and enthusiast programmers.

add comment

2 Answers

This is a quirk of the UCB ps command, which, back when 80-column terminals were sufficient, was never expected to need more than 5 chars for the size and RSS columns.

The standard (POSIX) ps output also looks rough when the SZ and RSS columns contain large numbers, but then it at least keeps a space between the columns.

With the POSIX ps command, you can use the -o option to specify which columns appear in the output, and you can also specify the column headings.

So you could use:

ps -o user,pid,pcpu,pmem,osz,rss,stime,time,args

to get similar output, and then use:

ps -o user,pid,pcpu,pmem,osz='---Size---' -o rss='---RSS---' -o stime,time,args

...to make the SZ and RSS columns wider.

But I think the POSIX ps command still truncates the args column, unlike the ww option of /usr/ucb/ps

share|improve this answer
add comment

Is ps -el available on those platforms? It produces fields of fixed lengths on Mac OS X and on Linux(Debian testing).

share|improve this answer
    
Please see above for my edited question,this has more detailed information that I am looking for. –  goutham Jul 6 '10 at 18:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.