How to Check CPU in Linux: nproc, lscpu, and RAM, Disk, and OS Info

Test environmentRHEL familyAlmaLinux 9.8root accountChecked 2026-10-29
System info · settings commandsnproclscpufreedflsblkuname

In Linux, nproc shows the CPU count in one line, and lscpu shows whether that number counts sockets, cores, or threads. Comparing nproc, lscpu, and /proc/cpuinfo on an AlmaLinux 9 server, the three commands printed the same logical CPU count under different names such as CPU(s) and processor. RAM, disk, and OS version were also checked on the same server with free, df, lsblk, and uname.

The CPU model, core count, memory and disk sizes, and kernel version in the outputs below are example values. What each command shows is summarized in the table first.

CommandWhat it shows
nprocNumber of usable CPUs (logical cores)
lscpuCPU model, sockets, cores, threads
free -hTotal, used, and free RAM
df -hDisk usage per file system
lsblkDisk and partition layout
cat /etc/os-releaseDistribution name and version
uname -rKernel version

1️⃣ Check CPU in Linux: nproc and lscpu

CPU(s) in lscpu is the number of logical CPUs the operating system uses, while the number of physical cores is read separately from the Core(s) per socket line. CPU(s) is calculated as sockets × cores per socket × threads per core.

If you only need the number of logical CPUs, nproc does it in one line.

nproc
4

According to the nproc manual, this value is the number of processing units available to the current process, so in environments that limit CPU use it can be lower than the number of online processors.

Where this 4 comes from appears at the top of the lscpu output.

lscpu | head -n 15
Architecture:                            x86_64
CPU op-mode(s):                          32-bit, 64-bit
Address sizes:                           46 bits physical, 48 bits virtual
Byte Order:                              Little Endian
CPU(s):                                  4
On-line CPU(s) list:                     0-3
Vendor ID:                               GenuineIntel
BIOS Vendor ID:                          Intel(R) Corporation
Model name:                              Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
BIOS Model name:                         Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
CPU family:                              6
Model:                                   85
Thread(s) per core:                      2
Core(s) per socket:                      2
Socket(s):                               1

Multiplying Socket(s) 1, Core(s) per socket 2, and Thread(s) per core 2 gives the 4 in CPU(s). The 0-3 in On-line CPU(s) list are the logical CPU numbers assigned by the operating system.

The vCPU in the AWS EC2 price list is also this logical CPU unit. According to the official documentation, EC2 counts one thread of a CPU core as one vCPU. An instance with 2 cores and 2 threads per core has 4 vCPUs, the same structure as the lscpu output above.

The -e option prints a table showing which core each of the four logical CPUs belongs to.

lscpu -e
CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE
  0    0      0    0 0:0:0:0          yes
  1    0      0    1 1:1:1:0          yes
  2    0      0    0 0:0:0:0          yes
  3    0      0    1 1:1:1:0          yes

CPU 0 and 2 share CORE 0, and CPU 1 and 3 share CORE 1. This structure, with two logical CPUs on one core, is hyper-threading (SMT). In the diagram below, press the command buttons to compare the names each of the three commands uses for this structure.

🧭 How CPU(s) 4 Is Built
Explainer diagram
🔍 Command
$ nproclscpucat /proc/cpuinfo
Socket 0Socket(s): 1physical id : 0
Core 0Core(s) per socket: 2core id : 0
CPU 0processor : 0
CPU 2processor : 2
Thread(s) per core: 2cpu cores : 2
Core 1Core(s) per socket: 2core id : 1
CPU 1processor : 1
CPU 3processor : 3
Thread(s) per core: 2cpu cores : 2
nproc → 4CPU(s): 4 = 1 × 2 × 2processor 0~3 · siblings : 4
nproc counts the logical CPUs available to the current process and prints 4. It does not split them into sockets and cores.
lscpu prints the same structure split into Socket(s) 1, Core(s) per socket 2, and Thread(s) per core 2, and the product of the three, 4, is CPU(s).
/proc/cpuinfo prints four blocks, numbering each logical CPU with processor, and records the socket as physical id and the core as core id. siblings 4 is the number of logical CPUs in the same socket, and cpu cores 2 is the number of physical cores.

2️⃣ Check CPU Info in Linux: /proc/cpuinfo

The source of the numbers lscpu summarizes is the /proc/cpuinfo file. The kernel writes one block per logical CPU, so on a server with CPU(s) 4 the same block appears four times in a row.

The cat command prints the whole file with all four blocks, while cutting it with head as below shows only the first block.

head -n 27 /proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 85
model name	: Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
stepping	: 4
microcode	: 0x2007006
cpu MHz		: 2394.374
cache size	: 28160 KB
physical id	: 0
siblings	: 4
core id		: 0
cpu cores	: 2
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault pti fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves ida arat pku ospke
bugs		: cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit mmio_stale_data retbleed gds bhi spectre_v2_user its
bogomips	: 4788.74
clflush size	: 64
cache_alignment	: 64
address sizes	: 46 bits physical, 48 bits virtual
power management:

These are the ten fields you will look at most often.

  • 🔢 processor
  • ↳ Logical CPU number (starts at 0)
  • 🏷️ model name
  • ↳ CPU model name
  • 🧩 physical id
  • ↳ Socket number this CPU belongs to
  • 👥 siblings
  • ↳ Number of logical CPUs in the same socket (twice cpu cores with hyper-threading)
  • 🧱 cpu cores
  • ↳ Number of physical cores in the same socket
  • 🆔 core id
  • ↳ Core number this logical CPU belongs to
  • ⏱️ cpu MHz
  • ↳ Current clock speed (MHz)
  • 🗄️ cache size
  • ↳ Cache size (same value as L3 cache in lscpu)
  • 🚩 flags
  • ↳ Features and instruction sets the CPU supports (ht, avx2, aes, etc.)
  • 📐 address sizes
  • ↳ Number of bits in physical and virtual addresses

Counting the processor lines gives the CPU count, and comparing siblings with cpu cores shows whether hyper-threading is on.

grep -c processor /proc/cpuinfo
4
grep -E 'siblings|cpu cores' /proc/cpuinfo | sort -u
cpu cores	: 2
siblings	: 4

There are 4 processor lines, siblings is 4, and cpu cores is 2, so each core runs two threads. The same fact was also confirmed with the value the kernel writes to /sys.

cat /sys/devices/system/cpu/smt/active
1

According to the kernel documentation, 1 means SMT is enabled and the sibling CPUs are online. If it is off, 0 is shown.

If you only need the CPU model name, collect the model name lines.

grep 'model name' /proc/cpuinfo | uniq -c
      4 model name	: Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz

The leading 4 means the same line appeared four times, so one line shows both the model name and the number of logical CPUs.

3️⃣ Check RAM Size in Linux: free and /proc/meminfo

Check the RAM size with the free command. Adding the -h option shows the values in Gi and Mi units.

free -h
               total        used        free      shared  buff/cache   available
Mem:           7.7Gi       4.1Gi       775Mi       112Mi       2.8Gi       3.3Gi
Swap:          2.0Gi       640Mi       1.4Gi

Read free memory from the available column. Even when the free column is small, Linux fills spare memory with file cache (buff/cache) and releases it as soon as a program needs it.

As in the output above, the free column can be 775Mi while available is 3.3Gi. According to the free manual, available is an estimate of the memory available for starting new programs without swapping.

For calculations in scripts, the -m option is the right choice. It prints whole numbers in MiB.

free -m
               total        used        free      shared  buff/cache   available
Mem:            7867        4219         775         112        2873        3400
Swap:           2047         640        1407

The source free reads is /proc/meminfo. The first five lines correspond to total, free, available, and buff/cache in free, and the unit is kB.

head -n 5 /proc/meminfo
MemTotal:        8055808 kB
MemFree:          793600 kB
MemAvailable:    3481600 kB
Buffers:              32 kB
Cached:          2856960 kB

Dividing MemTotal 8055808 kB by 1024 gives the same value as 7867 in free -m.

4️⃣ Check Disk Space in Linux: df and lsblk

df command prints the size and usage of mounted file systems, so it does not suit disks that are not mounted or a look at the partition layout. Use lsblk in that case.

df -h -x squashfs
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        3.9G     0  3.9G   0% /dev
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           1.6G  154M  1.5G  10% /run
efivarfs        128K  3.8K  120K   4% /sys/firmware/efi/efivars
/dev/nvme0n1p4   79G   10G   69G  13% /
/dev/nvme0n1p3  960M  269M  692M  28% /boot
/dev/nvme0n1p2  200M  7.7M  193M   4% /boot/efi
tmpfs           787M  8.0K  787M   1% /run/user/0

-x squashfs leaves out the loop file systems that snap packages mount read-only. The root (/) file system uses 10G of 79G, or 13%, and devtmpfs and tmpfs are file systems built on memory, so they are left out of the disk space count.

To see the file system type as well, add -T, and if you give a path, only the one line for the file system that path belongs to is shown.

df -hT /
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/nvme0n1p4 xfs    79G   10G   69G  13% /

The root was xfs. Use lsblk to see how the disk and partitions are divided. Adding -e 7 leaves out loop devices such as snap, so only the real disks remain.

lsblk -e 7
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
nvme0n1     259:0    0    80G  0 disk
├─nvme0n1p1 259:1    0     1M  0 part
├─nvme0n1p2 259:2    0   200M  0 part /boot/efi
├─nvme0n1p3 259:3    0     1G  0 part /boot
└─nvme0n1p4 259:4    0  78.8G  0 part /

One disk, nvme0n1, is split into four partitions, and nvme0n1p4 among them is mounted at the root, matching the 79G line in df.

5️⃣ Check the OS Version and Kernel in Linux: os-release and uname

Once you have read the CPU, memory, and disk numbers, also check which distribution and kernel the server runs on. The distribution name, version, and end-of-support date are all in one file, /etc/os-release.

cat /etc/os-release
NAME="AlmaLinux"
VERSION="9.8 (Olive Jaguar)"
ID="almalinux"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.8"
PLATFORM_ID="platform:el9"
PRETTY_NAME="AlmaLinux 9.8 (Olive Jaguar)"
ANSI_COLOR="0;34"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:almalinux:almalinux:9::baseos"
HOME_URL="https://almalinux.org/"
DOCUMENTATION_URL="https://wiki.almalinux.org/"
BUG_REPORT_URL="https://bugs.almalinux.org/"

ALMALINUX_MANTISBT_PROJECT="AlmaLinux-9"
ALMALINUX_MANTISBT_PROJECT_VERSION="9.8"
REDHAT_SUPPORT_PRODUCT="AlmaLinux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.8"
SUPPORT_END=2032-06-01

The PRETTY_NAME line is the human-readable name, and VERSION_ID is the version number scripts compare. The SUPPORT_END line confirmed the end-of-support date as well.

On RHEL-based systems, /etc/redhat-release also shows the same version in one line.

cat /etc/redhat-release
AlmaLinux release 9.8 (Olive Jaguar)

Kernel version: uname -r prints it in one line.

uname -r
5.14.0-687.10.1.el9_8.x86_64
uname -a
Linux server 5.14.0-687.10.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jun 2 10:15:42 EDT 2026 x86_64 x86_64 x86_64 GNU/Linux

Adding -a puts the kernel name, host name, kernel version, build date, and architecture on one line. Among them, x86_64 is the CPU architecture, the same value as the Architecture line in lscpu.

🔲 Linux CPU Check Simulator

In the simulator below, you can type nproc, lscpu, free, df, lsblk, and uname yourself and check the output. The values are the same example values as in the text.

Linux CPU Check SimulatorAlmaLinux 9.8
[root@server work]#
Use the ↑↓ keys to recall commands you typed earlier.

🔢 FAQ & Recommended Content

Yes, they can. According to the nproc manual, nproc prints the number of processing units available to the current process, so in environments that limit which CPUs a process can use, it is smaller than the number of online processors. Check the total number of installed processors with nproc [--all]. On the tested server, the two values were the same.

The free column is memory that is not allocated to anything and sits empty. According to the free manual, available is an estimate of the memory available for starting new programs without swapping. It is calculated by adding reclaimable page cache and reclaimable slab memory, so look at available when judging spare memory.

If Thread(s) per core in lscpu is 2, each core runs two logical CPUs. In /proc/cpuinfo, siblings is twice cpu cores, and the value of the /sys/devices/system/cpu/smt/active file is 1. All three showed the enabled value on the same server.

ℹ️ Affiliate Disclosure
This site's content contains affiliate links. When a visitor buys a product or service through one of them, the site receives a commission from the seller. The amount the buyer pays(it goes down during event discounts ↓)does not go up. Posted prices, discounts, and stock reflect the time of writing and may differ, so confirm with the seller before buying. Products are chosen and reviewed by our own standards, and commissions do not affect the order or content of reviews.

Leave a Reply

Your email address will not be published. Required fields are marked *

Prove your humanity: 9   +   3   =