Last active
July 1, 2017 07:42
-
-
Save JJ/d42b5d13820ae4f7ef72b2195f43da41 to your computer and use it in GitHub Desktop.
Get the process consuming the most CPU with a trimmed down version of ps, i.e., in busybox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get the list of PIDs and cpu usage via the batch version of top if ps is not fully functional, take out the headers, sort numerically using the 9th column, which is the CPU usage as key, take the last one, and extract the second column | |
top -n 1 -b | tail -n +8 | sort -k9 -n | tail -1 | cut -d ' ' -f 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment