Reputation: 174
ps -eo user,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,group,args | awk 'match($0, /some[0-9]/)'
-
When I run this command on my Debian server, the output of the "group" column will be stripped due to not enough space.
Man ps: "egroup EGROUP effective group ID of the process. This will be the textual group ID, if it can be obtained and the field width permits, or a decimal representation otherwise.
(alias group)."
I have tried:
ps -eo user,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,group,args | awk 'match($0, /some[0-9]/)'
ps -wwo user,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,group,args | awk 'match($0, /some[0-9]/)'
ps --width 90000000 -eo user,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,group,args | awk 'match($0, /some[0-9]/)'
ps -wweo user,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,group,args | awk 'match($0, /some[0-9]/)' | cat
But still, the group column is converted to decimals instead of group name.
So my question is: How can I tell ps to always show me full columns.
Note: this command is running thru php exec().
Thank you.
Upvotes: 2
Views: 1909
Reputation: 174
Problem was solved by adding a width to a column itself:
ps -eo user,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,group:50,args | awk 'match($0, /some[0-9]/)'
Where 50 from "group:50
" is the width of the column.
Upvotes: 4