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?
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?
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
.
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