When you are running any script on server or running any application you want to know how much memory or disk uses is happened by application.

how to find out cpu and disk usage in linux

how to find out cpu and disk usage in linux

how to find out cpu and disk usage in linux

When you are doing load testing this time this kind of applications are very useful to check the server status. Create file name CPU-Disk.sh and put following content in that.

#!/bin/sh

# Change this as needed

OUTPUT_FILE=file.txt

# Initially delete old output file if needed.

/bin/rm -f $OUTPUT_FILE

while [ 1 -eq 1 ]; do

date >> $OUTPUT_FILE

echo "------------------------" >> $OUTPUT_FILE

cat /proc/meminfo >> $OUTPUT_FILE

echo "------------------------" >> $OUTPUT_FILE

df -k >> $OUTPUT_FILE

echo "------------------------" >> $OUTPUT_FILE

top -b -i -n 1 >> $OUTPUT_FILE

# Record terminator. Add more === if needed 🙂

echo "========================" >> $OUTPUT_FILE

sleep 60

done

This command is useful to create the sh file executable in linux

#chmod +x /YOURPATH/CPU-Disk.sh

when you need to check the server status you need to run the this file using this command

#CPU-Disk

Written by Purab

My name is Purab, Here is my Personal Blog: wpapi.com. I contributor of many wordpress plugins and Drupal Modules. I am core developer of Drupal. Connect to on LinkedIn or Follow @purab on Twitter or Follow me on Google+ or Write Mail to purabdk@gmail.com or Chat with me on Skype : purabdk

Leave a Comment

Your email address will not be published. Required fields are marked *