Using ps to do this is unreliable — a process’ arguments can contain newlines. A better alternative on Linux is to use /proc/loadavg like so:
awk ‘{ gsub(“[0-9]+/”, “”) ; print $4 }’ /proc/loadavg
Using ps to do this is unreliable — a process’ arguments can contain newlines. A better alternative on Linux is to use /proc/loadavg like so:
awk ‘{ gsub(“[0-9]+/”, “”) ; print $4 }’ /proc/loadavg