Checking the CPU on Ubuntu is an essential task for monitoring and troubleshooting system performance. In this guide, we will go through the steps to check CPU information on Ubuntu using the command line.
Step 1: Open the Terminal
The first step is to open the terminal on your Ubuntu machine. You can do this by clicking on the terminal icon or by using the keyboard shortcut “Ctrl + Alt + T”.
Step 2: Check CPU Information Using the lscpu Command
The “lscpu” command displays the CPU information on your Ubuntu machine. To use this command, open a terminal and type the following command:
lscpu
The output will display detailed information about the CPU, including the number of cores, clock speed, cache size, and other features.
Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 8 On-line CPU(s) list: 0-7 Thread(s) per core: 1 Core(s) per socket: 1 Socket(s): 8 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 106 Model name: Intel(R) Xeon(R) Gold 6336Y CPU @ 2.40GHz Stepping: 6 CPU MHz: 2399.998 BogoMIPS: 4799.99 Virtualization: VT-x Hypervisor vendor: KVM Virtualization type: full L1d cache: 32K L1i cache: 32K L2 cache: 4096K L3 cache: 16384K NUMA node0 CPU(s): 0-7
Step 3: Check CPU Usage Using the top Command
The “top” command displays the real-time CPU usage on your Ubuntu machine. To use this command, open a terminal and type the following command:
top
The output will display a live view of the system processes, including CPU usage, memory usage, and other details. To exit the “top” command, press “q” on your keyboard.
Step 4: Check CPU Temperature Using the lm-sensors Package (Optional)
The “lm-sensors” package is a command-line tool that can be used to monitor the temperature sensors on your Ubuntu machine, including the CPU temperature. To install “lm-sensors”, open a terminal and type the following command:
sudo apt-get install lm-sensors
Once installed, you can use the “sensors” command to display the CPU temperature. To use this command, open a terminal and type the following command:
sensors
The output will display the temperature sensors on your Ubuntu machine, including the CPU temperature.
Commands Mentioned:
- lscpu – a command that displays the CPU information on your Ubuntu machine.
- top – a command that displays the real-time CPU usage on your Ubuntu machine.
- sudo – a command that allows users to run programs with the security privileges of another user, typically the superuser.
- apt-get – a command-line tool used to manage packages on Ubuntu.
- lm-sensors – a package that can be used to monitor the temperature sensors on your Ubuntu machine.
- sensors – a command that displays the temperature sensors on your Ubuntu machine.
Conclusion:
In this guide, we have outlined the steps to check CPU information on Ubuntu using the command line. By using the “lscpu” and “top” commands, you can easily obtain the necessary information about the CPU on your Ubuntu machine. If you have any questions or suggestions, feel free to comment below.