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?

1
  • 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". Jul 3, 2010 at 0:38

2 Answers 2

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.

3
  • 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, 2010 at 18:13
  • @goutham: That version of ps doesn't have -o, use the other one. I believe it's /bin/ps. Jul 6, 2010 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, 2010 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

1
  • What does df have to do with ps?
    – alanc
    Apr 4, 2011 at 22:45

You must log in to answer this question.

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