4 export I_WANT_A_BROKEN_PS
12 cat >/tmp/awk.xxx$$ <<'!'
14 state["D"] = "Spinwait";
19 state["T"] = "Stopped";
20 state["Z"] = "Zombie";
22 state["X"] = "Moribund";
27 t = state[substr(s, 1, 1)];
33 # rsc 36706 starttime 0:00.17 1076 Is+ -bash (bash)
39 if(start ~ /^[A-Z][a-z][a-z]$/){
40 start = start "-" $i; i++
46 if(ENVIRON["all"] == "yes"){
55 sub(/\.[0-9][0-9]$/, "", cputime); # drop .hundredths of second
56 if(cputime ~ /..:..:../){ # convert hh:mm:ss into mm:ss
57 split(cputime, a, ":");
58 cputime = sprintf("%d:%02d", a[1]*60+a[2], a[3]);
60 if(start ~ /..:..:../){ # drop :ss
61 sub(/:..$/, "", start);
63 printf("%-8s %11d %8s %8s %8dK %-8s %s\n",
64 user, pid, start, cputime, mem, statestr(stat), cmd);
68 /bin/ps -axww -o 'user,pid,start,time,vsz,stat,command' | sed 1d |
69 awk -f /tmp/awk.xxx$$ | sort -n +1