In bash, show a list with: process cpu time, nice priority and custom command. in different columns

Viewed 79

The custom comand is: the calculation of the relation between resident memory and the need of exchange memory necessary to store the process in case of suspending it and the owner of the process.
I know ps -eo cputime,nice but I want another column with my custom calculation and I dont know how.

P.D. And if I want to add in my script: -nice a b, where it will process only the processes in "a-b" range how it could be.

Thanks.

1 Answers
ps -eo cputime,nice | awk '{print $1,$2,"your_custom_column"}'

Where in place your_custom_column you can put what ever you want

Related