Linux CPU Commands [ 2024 ]
Linux CPU Commands
This post will introduce some commands to know the CPU information on the Linux box. CPU stands for Central Processing Unit. It acts like the brain of the computer. It processes data, runs programs, and manages computer hardware components. The primary function of a CPU is to execute programs.
More information: Block Diagram of Computer
Linux keeps the processor(s) or the CPU information in a file called /proc/cpuinfo.
To know the information, open a terminal and issue the following command.
$ cat /proc/cpuinfo

$ lscpu
The lscpu command displays information about the CPU architecture, number of CPUs, cores per CPU, threads per core, CPU family, model, CPU caches, etc.
Other common CPU commands are as follows:
top: Displays real-time system summary, including CPU usage.

Some more commands:
| Command | Description |
|---|---|
| htop | An interactive process viewer showing CPU usage per core. |
| mpstat | The mpstat command reports CPU statistics. |
| lscpu | The lscpu displays detailed CPU architecture information. |
| uptime | The uptime command shows how long the system has been running and load averages. |
| sar | The sar command collects, reports, and saves system activity information. |
| vmstat | Reports virtual memory statistics and system performance. |