CPU usage Linux scripts and commands

Script to run top command after every 5 minutes CPU utilization:

#!/bin/sh

top -b -n 1 | head -17 >> /var/log/logging.txt

echo “=========” >> /var/log/logging.txt

To show CPU and process information (press q to quit):

#top (resource usage and running processes)

(uptime and the load average)

(CPU usage: us for users, sy for system and ni for nice processes)(id is idle time, wa is wait state)

(if the wa is high that means the smoothwall is busy with extensive logs or reports)

(press ‘F’ to set the fields and ‘d’ to set it)

#htop (resource usage and running processes)(same as top but better layout)

Advertisements

Posted on January 6, 2016, in Linux (Ubuntu/CentOS), Uncategorized. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: