Skip to content

Instantly share code, notes, and snippets.

@omidp
Created February 15, 2022 07:20
Show Gist options
  • Save omidp/fef4f0f7a0171c8ed604fd3115cc6805 to your computer and use it in GitHub Desktop.
Save omidp/fef4f0f7a0171c8ed604fd3115cc6805 to your computer and use it in GitHub Desktop.
monitor cpu and mem for a pid
vi pdmonitor.sh
###########
#!/bin/sh
while true
do
date
ps -p [PID] -o %cpu,%mem
sleep 5
done
############
chmod +x pdmonitor.sh
############
./pdmonitor.sh
OR
./pdmonitor.sh > result.txt
@omidp
Copy link
Author

omidp commented Feb 15, 2022

other commands

  • iostats
  • top
  • htop
  • mpstats 5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment