I want to get all the info from Activity Monitor in the terminal (because I am executing these commands in macOS app). It also has to terminate – e.g. for top
I can write:
top -pid <somepid> -l3 -n30 > test ; tail -n42 ./test > ./test2 ; open ./test2
and this would get 3 recordings and terminate.
So far, I managed to run top
command and get most of the metrics. However, there are many that top
doesn't provide, such as GPU and networking.
I am familiar with systemstats
but this is not on a per-process basis. I can grep some parts of systemstats, but there is not guarantee that my process is going to be in the list of GPU usage section.
Need to support 10.14 Mojave and 10.15 Catalina
Any other commands that I can use, or maybe ways I can tweak systemstats to work for my case?
Best Answer
netstat
: This command shows network statusiostat
: This command displays information about CPU usage, and I/O statisticsvm_stat
: This command virtual memory statisticsTo my knowledge, there is no command to get GPU usage on macOS.