Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .