Last active
August 18, 2022 12:36
-
-
Save scottstensland/d882d1acd94bb67d969df8f17c6e0e0f to your computer and use it in GitHub Desktop.
issue process list to show top cpu and ram usage
This file contains hidden or 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
#!/bin/bash | |
# ... issue process list to show top cpu and ram usage | |
# usage : | |
# | |
# show_cpu_and_memory_usage.sh >> /file/holding/usage.log | |
SLEEP_PERIOD=5 | |
output_header=$( ps aux|head -1 ) | |
while true; do | |
curr_snapshot=$( ps aux | sort -nrk 3,3 | cut -c1-155 | head -n 20 ) | |
echo | |
date '+%Y%m%d_%H%M%S' | |
echo | |
echo "$output_header" | |
echo "$curr_snapshot" | |
sleep $SLEEP_PERIOD | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment