Sunday, April 1, 2018

PS | Script for Top equivalent command for AIX



#!/bin/sh

# If the shell script is stopped with CTRL+C, the screen
# might need to be sized correctly.

trap 'eval $(resize); exit 2' 2

# A loop to display activity.
while [ 1 ] ; do
eval $(resize)
#output=$(ps -eF "pcpu time pid user rssize comm" | grep -v TIME | sort -rn | head -$(("$LINES"-2)))
output=$(ps -eF "pcpu time pid user time etime rssize comm" | grep -v TIME | sort -rn | head -$(("$LINES"-2)))

echo ' %CPU TIME PID USER TIME ELAPSED RSS COMMAND'
echo "$output"
sleep 3
done
------------------------
ps -eof pid,cmd linux
ps -ef -o pid,args aix

ps f  # show ascii tree hierarchy
ps f -eo rss,ppid,pid,cmd   # shows memory process parent id, process id, comand and ascii hierarchy
ps faux # shows all process of all users and tree hierarchy


print all children of xrdp program
ps f -g $(ps -o sid= -p `pidof xrdp`)

pstree # show hierarchy with lines instead of slash and bars

http://meinit.nl/alternative-top-aix

No comments:

Blog Archive