Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get CPU utilisation, RAM utilisation in MAC from commandline

Tags:

macos

I know that using Activity Monitor we can see CPU utilisation.But i want to get this information of my remote system through script. top command is not helpful for me. Please comment me any other way to get it.

like image 873
MacDeveloper Avatar asked Dec 12 '22 01:12

MacDeveloper


1 Answers

What is the objection to top in logging mode?

top -l 1 | grep -E "^CPU|^Phys"

CPU usage: 3.27% user, 14.75% sys, 81.96% idle 
PhysMem: 5807M used (1458M wired), 10G unused.

Or use sysctl

sysctl vm.loadavg
vm.loadavg: { 1.31 1.85 2.00 }

Or use vm_stat

vm_stat
Mach Virtual Memory Statistics: (page size of 4096 bytes)
Pages free:                                3569.
Pages active:                            832177.
Pages inactive:                          283212.
Pages speculative:                      2699727.
Pages throttled:                              0.
Pages wired down:                        372883.
like image 72
Mark Setchell Avatar answered May 18 '23 21:05

Mark Setchell