In Linux systems, there are several tools available for viewing CPU information. Here are a few methods:
-
lscpu Command: The
lscpu
command is a simple way to view CPU information. It provides details about the processor architecture, number of CPU cores, number of threads, cache size, byte order, and more. By using thelscpu
command, you can obtain detailed information about the CPU, including:- Architecture: Displays the processor architecture of the operating system, such as x86, x86_64, ARM, etc.
- CPU op-mode(s): Shows the operating modes supported by the processor, such as 32-bit and 64-bit.
- Byte Order: Indicates the byte order used by the processor, e.g., Little Endian or Big Endian.
- CPU(s): Displays the total number of CPUs in the system.
- Core(s) per socket: Shows the number of cores in each CPU socket.
- Thread(s) per core: Indicates the number of threads supported by each core (hyper-threading technology).
- Socket(s): Displays the number of CPU sockets in the system.
- NUMA node(s): Shows the number of nodes in a Non-Uniform Memory Access (NUMA) architecture.
- Vendor ID: Displays the identifier of the CPU manufacturer.
- CPU family: Shows which family the CPU belongs to.
- Model: Displays the model number of the CPU.
- Model name: Shows the specific model name and designation of the CPU.
- To use the
lscpu
command, simply enterlscpu
in the terminal and press Enter. The system will display output containing the above information.
-
/proc/cpuinfo File: The
/proc/cpuinfo
file is a special file that contains detailed information about the CPU. You can display its content using the commandcat /proc/cpuinfo
. The output of this file includes information such as processor type, number of CPU cores, model name, model number, CPU frequency, and cache size. -
top Command: The
top
command is a tool for monitoring system resource usage in real-time. It can also be used to view CPU information. In the output of the top command, the CPU column displays CPU usage and state information. You can press the “1” key to see the usage of each CPU core. -
mpstat Command: The
mpstat
command is a tool that reports CPU usage in multi-processor systems. It can be used to view the usage, idle time, and other statistics for each CPU core. For example, the commandmpstat -P ALL
will display the usage rate and other useful information for each core in the terminal. -
nproc Command: The
nproc
command is a quick way to check the number of CPU cores in the system. This command will return the number of CPU cores currently present in the system, allowing you to understand its hardware configuration.
These tools can assist you in viewing CPU information in Linux systems, and the specific method to use depends on your needs and preferences.