الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

lscpu

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

المستوى
لينكس اليومي
المجموعة
معلومات النظام
يحتاج root
لا
الحزمة
util-linux

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

ماذا يفعل

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.

طريقة الكتابة

lscpu [OPTION]...

الخيارات 15

الأكثر استخدامًا

-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.

أمثلة 10

$ مستخدم عادي# بصلاحية root (أو مع 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.

رموز الخروج

0Done.
1Error.

الدليل الكامل

هذه الصفحة تشرح الأمر بكلمات بسيطة. الدليل الأصلي فيه كل التفاصيل.

في الطرفية: man lscpu