Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

lscpu

Show the CPU: architecture, model, sockets, cores, threads, caches, flags, virtualization and CPU security bugs.

Niveau
Dagelijks Linux
Groep
Systeeminformatie
Root nodig
Nee
Pakket
util-linux

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

lscpu collects CPU data from /proc/cpuinfo and /sys. Useful lines: CPU(s), Thread(s) per core, Core(s) per socket, Socket(s), Model name, Hypervisor vendor, Virtualization, and the Vulnerability lines (Spectre, Meltdown …) with their mitigation status.

Zo schrijf je het

lscpu [OPTION]...

Opties 15

Meest gebruikt

-e, --extended[=LIST]
One line per CPU (CPU, CORE, SOCKET, NODE, ONLINE, MHZ …).
-p, --parse[=LIST]
Parsable output per CPU.
-C, --caches[=LIST]
Cache details.
-J, --json
JSON output.
-a, --all
With -e/-p: also offline CPUs.
-b, --online
Only online CPUs.
-c, --offline
Only offline CPUs.
-B, --bytes
Sizes in bytes.
-x, --hex
CPU masks in hex.
-y, --physical
Physical IDs instead of logical ones.
--hierarchic[=WHEN]
Grouped output.
--output-all
All columns.
-s, --sysroot DIR
Read from another root.
-h, --help
Show help.
-V, --version
Show the version.

Voorbeelden 10

$ als gewone gebruiker# als root (of met sudo)

  1. 1CPU overview

    lscpu
    Architecture:             x86_64
    CPU(s):                   2
    Model name:               Intel Xeon Processor (Icelake)
    Hypervisor vendor:        KVM

    Plus sockets, cores, caches, flags.

  2. 2Cores and threads

    lscpu | grep -E '^(CPU\(s\)|Thread|Core|Socket)'

    CPUs = sockets × cores × threads.

  3. 3Is this a VM?

    lscpu | grep -i hypervisor
    Hypervisor vendor:        KVM

    No line = physical machine.

  4. 4Can it run VMs?

    lscpu | grep -i virtualization

    VT-x or AMD-V needed for KVM.

  5. 5CPU security mitigations (security)

    lscpu | grep -i vulnerab
    Vulnerability Spectre v2:  Mitigation; Enhanced / Automatic IBRS

    "Vulnerable" lines need a kernel or microcode update.

  6. 6Per CPU table

    lscpu -e

    Which CPU is on which core and socket.

  7. 7Caches

    lscpu -C

    L1, L2, L3 sizes.

  8. 8JSON for inventory

    lscpu -J | jq -r '.lscpu[] | select(.field=="Model name:") | .data'

    Model for an asset list.

  9. 9CPU flags (like AES or AVX)

    lscpu | grep -o -w -E 'aes|avx2|avx512f' | sort -u

    Does the CPU support hardware AES?

  10. 10Compare with nproc

    nproc; lscpu | grep '^CPU(s)'

    nproc = usable now, lscpu = present.

Exitcodes

0 :: Done. 1 :: Error.

Volledige handleiding

Deze pagina legt het commando uit in eenvoudige woorden. De originele handleiding heeft elk detail.

In je terminal: man lscpu