Using the top -b -n1
command I can get the resources utilised by my system for that instance. However, I actually need specific values out of it. I need things like, overall CPU usage, overall memory usage, and the top 5 processes using the cpu resources for that instance.
Currently I am able to find:
Cpu usage: top -b -d1 -n1|grep -i 'Cpu(s)'|head -c21|cut -d '' -f3|cut -d '%' -f1
Top 5 process : ps aux | sort -nrk 3,3 | head -n 5
I am unable to work out something for the Ram usage. I am trying commands something like in the Cpu usage command, but it returns me nothing. To be frank, I am unable to cut it out properly. Some help in retrieving that is appreciated.
Extra Help: Also, on the same grounds, is it possible to get the mac address of the system. Like a command that might just return me the mac address and not 100s of lines that I need to manipulate.
Thank you for the help.