Linux – メモリ、CPU の情報を確認する lsmem、lscpu コマンドについて解説

概要

この記事では、メモリの情報を確認する lsmem コマンド、CPU の情報を確認する lscpu コマンドについて解説します。

lsmem コマンド: メモリ情報を確認する

lsmem コマンドは、システムのメモリブロックの情報を表示するためのツールです。 以下は lsmem コマンドの一般的な使い方とオプションについてです。

$ lsmem --output-all
RANGE                                  SIZE  STATE REMOVABLE  BLOCK NODE  ZONES
0x0000000000000000-0x0000000007ffffff  128M online       yes      0    0   None
0x0000000008000000-0x00000000bfffffff  - 9G online       yes   1-23    0  DMA32
0x00000000c0000000-0x00000000c7ffffff  128M online       yes     24    0   None
0x0000000100000000-0x000000042fffffff 1- 8G online       yes 32-133    0 Normal
0x0000000430000000-0x0000000437ffffff  128M online       yes    134    0   None

Memory block size:       128M
Total online memory:      16G
Total offline memory:      0B
Bash

主なオプション

オプション 説明
--all, -a すべてのメモリ情報を表示します。
--bytes, -b サイズをバイト単位で表示します。
--gigabytes, -g サイズをギガバイト単位で表示します。
--human-readable, -H 人間に読みやすい形式でサイズを表示します (KB, MB, GB など)。
--output [FIELDS] 特定の項目を表示します。項目名をカンマ区切りで指定します。
--output-all すべての項目を表示します。
--summary, -s メモリの要約情報を表示します。

使用例

  • すべてのメモリ情報を表示:

    lsmem --all
    Bash
  • バイト単位でサイズを表示:

    lsmem --bytes
    Bash
  • ギガバイト単位でサイズを表示:

    lsmem --gigabytes
    Bash
  • 要約情報を表示:

    lsmem --summary
    Bash
  • 特定の項目のみを表示:

    lsmem --output RANGE,SIZE
    Bash

各項目の説明

以下は、lsmem コマンドの出力項目です:

項目名 説明
RANGE メモリブロックの開始アドレスと終了アドレスの範囲
SIZE メモリブロックのサイズ
STATE メモリブロックの状態 (online/offline)
REMOVABLE メモリブロックが取り外し可能かどうか (yes/no)
BLOCK メモリブロックの番号
NODE メモリブロックが属する NUMA ノード
ZONES メモリゾーンのタイプ (DMA, DMA32, Normal, None)

lscpu コマンド: CPU 情報を確認する

lscpu コマンドは、CPU のアーキテクチャ情報を表示するためのツールです。

$ lscpu
Architecture:                         x86_64
CPU op-mode(s):                       32-bit, 64-bit
Byte Order:                           Little Endian
Address sizes:                        39 bits physical, 48 bits virtual
CPU(s):                               8
On-line CPU(s) list:                  0-7
Thread(s) per core:                   2
Core(s) per socket:                   4
Socket(s):                            1
NUMA node(s):                         1
Vendor ID:                            GenuineIntel
CPU family:                           6
Model:                                94
Model name:                           Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
Stepping:                             3
CPU MHz:                              4000.000
CPU max MHz:                          4200.0000
CPU min MHz:                          800.0000
BogoMIPS:                             7999.96
L1d cache:                            128 KiB
L1i cache:                            128 KiB
L2 cache:                             1 MiB
L3 cache:                             8 MiB
NUMA node0 CPU(s):                    0-7
Vulnerability Gather data sampling:   Vulnerable: No microcode
Vulnerability Itlb multihit:          KVM: Mitigation: VMX unsupported
Vulnerability L1tf:                   Mitigation; PTE Inversion
Vulnerability Mds:                    Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown:               Mitigation; PTI
Vulnerability Mmio stale data:        Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Mitigation; IBRS
Vulnerability Spec rstack overflow:   Not affected
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; IBRS; IBPB conditional; STIBP conditional; RSB filling; PBRSB-eIBRS Not affected; BHI Not affec
                                      ted
Vulnerability Srbds:                  Mitigation; Microcode
Vulnerability Tsx async abort:        Mitigation; TSX disabled
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2
                                      ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology no
                                      nstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid s
                                      se4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpu
                                      id_fault invpcid_single pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx r
                                      dseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hw
                                      p_act_window hwp_epp md_clear flush_l1d arch_capabilities
Bash

オプション

オプション 説明
-a, --all すべての情報を表示します (デフォルト)。
-b, --online オンライン状態の CPU の情報のみを表示します。
-c, --offline オフライン状態の CPU の情報のみを表示します。
-p, --parse パース可能な形式で出力します (例: -p=CPU,CORE で特定項目を表示)。
-J, --json JSON 形式で出力します。
-y, --yaml YAML 形式で出力します。
-s, --sysroot ルートディレクトリを指定します。

各項目の説明

項目名 説明
Architecture CPU のアーキテクチャ (例: x86_64)
CPU op-mode(s) サポートされている CPU の動作モード (例: 32-bit, 64-bit)
Byte Order バイトオーダー (例: Little Endian)
Address sizes 物理アドレスと仮想アドレスのビット数
CPU(s) システム内の CPU の総数
On-line CPU(s) list オンライン状態の CPU のリスト
Thread(s) per core コアあたりのスレッド数
Core(s) per socket ソケットあたりのコア数
Socket(s) ソケットの数
NUMA node(s) NUMA ノードの数
Vendor ID ベンダー ID (例: GenuineIntel)
CPU family CPU ファミリー番号
Model CPU モデル番号
Model name CPU のモデル名 (例: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz)
Stepping CPU のステッピング番号
CPU MHz CPU の現在の動作周波数 (MHz)
CPU min MHz CPU の最小の動作周波数 (MHz)
CPU max MHz CPU の最大の動作周波数 (MHz)
BogoMIPS BogoMIPS 値 (CPU の相対性能を示す指標)
Virtualization 仮想化技術のサポート状況 (例: VT-x)
L1d cache L1 データキャッシュのサイズ
L1i cache L1 命令キャッシュのサイズ
L2 cache L2 キャッシュのサイズ
L3 cache L3 キャッシュのサイズ
NUMA node0 CPU(s) NUMA ノード 0 に属する CPU のリスト
Vulnerability 脆弱性の状況
Flags CPU の機能を示すフラグのリスト

コメント

コメントする