Bash monitor CPU & RAM

I’ve made a nice simple little #bash script that can you monitor your #Linux CPU and Memory from command line in a loop when running some heavy load using the simple top command.


#!/usr/bin/env bash
while true; do 
echo CPU - $(top -b -n 1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}'); 
echo MEM - $(top -b -n 1 | grep "MiB Mem" | awk 'FNR == 1 {print $8/($8+$6)*100}'| cut -c1-5)%;
sleep 10; 


This is a simple bash script you can run at home or local network and show you all IP address with open ports. This script is going to run through IP range 1 to 254 through address 192.168.0.x The ports that will be checked are:SSH – 22HTTP – 80HTTPS – 443MYSQL – 3306RDP – 3389PRINTER […]