LoginSignup
0
1

macOSのリソースの情報をコマンドで取得する

Posted at

What's?

macOSのリソースの情報をコマンドで取得したくなることがたまにあるのですが、いつも忘れて調べ直しているのでメモとして。

環境

$ sw_vers
ProductName:            macOS
ProductVersion:         14.3.1
BuildVersion:           23D60

ハードの情報を確認する

$ system_profiler SPHardwareDataType

CPU数、コア数を確認する

CPU数

$ system_profiler SPHardwareDataType | perl -wnl -e 'print $1 if /Number of Processors: (\d+)/'

コア数

$ system_profiler SPHardwareDataType | perl -wnl -e 'print $1 if /Total Number of Cores: (\d+)/'

CPU使用率を確認する

$ top | grep 'CPU usage'

メモリ搭載量を確認する

$ system_profiler SPHardwareDataType | perl -wnl -e 'print $1 if /Memory: (.+)/'

メモリ使用率を確認する

$ top | grep 'PhysMem'

ストレージ使用率を確認する

$ df -h

macOSだと、CPUやメモリの使用率はtopコマンド中心になるんだな、と。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1