3

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?

goutham
  • 131
  • 2
  • 3
  • 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 03 '10 at 00:38

2 Answers2

4

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.

Dennis Williamson
  • 62,149
  • 16
  • 116
  • 151
  • 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 06 '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 06 '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 06 '10 at 18:38
-2

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

user50681
  • 52
  • 1