-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
MacOS doesn't follow Linux style mapping of files to system information. But we do have useful CLI commands.
The main command I found for this is sysctl and sysctl -a gives all system information.
Specific commands
// total memory size
$ sysctl hw.memsize
// cpu info
$ sysctl hw.ncpu
$ sysctl vm.loadavg
vm.loadavg: { 1.31 1.85 2.00 }RAM usage can be parsed using top -l 1. It pretty much gives us everything in single snapshot, but I am not sure about regex.
Also top commands seems to be slow, vm_stat is better option for RAM. The values will need to be computed.
Also Mac has a concept of Wired Memory. Need to read a bit about it.
Battery info can be fetched using pmset -g batt
References
- https://stackoverflow.com/questions/68780116/is-there-any-alternative-for-proc-in-macos
- https://www.adamnengland.com/2021/01/19/cpu-ram-data-in-your-os-x-terminal/
- https://stackoverflow.com/questions/28168054/how-to-get-cpu-utilisation-ram-utilisation-in-mac-from-commandline
- https://apple.stackexchange.com/questions/4286/is-there-a-mac-os-x-terminal-version-of-the-free-command-in-linux-systems
- https://coderwall.com/p/bechiq/macos-get-battery-percentage-from-command-line
- https://www.hexnode.com/mobile-device-management/help/script-to-view-battery-status-on-macos-devices/
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels