I am trying to execute some PS commands on IBM AIX and Solaris. The output I get is not properly formatted, I want to see the values for each column with some fixed width.

Is there anyway I can mention width for each column that PS command shows?

link|improve this question
It would help if you showed the actual command that you're trying. ps output is normally aligned in columns without any extra effort. Also, show an example of what you mean by "not properly formatted". – Dennis Williamson Jul 3 '10 at 0:38
feedback

2 Answers

In GNU ps, you can specify the field width to widen a field:

ps axw o user:10,pid:8,%cpu:8,cmd

In Solaris and AIX, you can specify the column header to widen columns. Here, I'm padding with hyphens, but you could use something else:

ps -ef -o user=---USER---,pid=---PID--,%cpu=--%CPU--,cmd

This also works for GNU ps.

link|improve this answer
I am trying command "/usr/ucb/ps auxww -o user=---USER---" solaris, but I am getting error as "/usr/ucb/ps: illegal option -- o". Any clue? – goutham Jul 6 '10 at 18:13
@goutham: That version of ps doesn't have -o, use the other one. I believe it's /bin/ps. – Dennis Williamson Jul 6 '10 at 18:26
I have to use /ucb/ps command because I want to get use,SZ, RSS and complete command for each running process. I have tried /bin/ps with some arguments but I not getting information I need. That is the reason for usuing /ucb/ps command. – goutham Jul 6 '10 at 18:38
feedback

I script against a Posix complaint df which standardizes the output for both AIX and Support.

AIX: /bin/df -kP

SUN: /usr/xpg4/bin/df -kP

link|improve this answer
What does df have to do with ps? – alanc Apr 4 '11 at 22:45
feedback

Your Answer

 
or
required, but never shown

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