CPU usage Linux scripts and commands

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


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)


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 )

Facebook photo

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

Connecting to %s

%d bloggers like this: