lscpu Linux Command Guide
The lscpu command in Linux provides detailed information about the CPU architecture, processing units, sockets, cores per socket, threads per core, and more. It helps users understand the configuration of their CPU and how it is utilized by the system. By running lscpu, you can quickly access essential details about your CPU, such as its model name, vendor, CPU family, cache sizes, and processor flags. This command is useful for system administrators, developers, and users who need to optimize system performance, troubleshoot issues, or gather information about the CPU for various purposes.
lscpu Syntax:
Section titled “lscpu Syntax:”lscpu [options]
Options:
Section titled “Options:”Option | Description |
---|---|
-a | Display all information |
-p | Show all available information |
-e | Show extended information |
-s | Show short output |
-x | Show additional details |
-y | Show information in YAML format |
-c | Show information in CSV format |
Parameters:
Section titled “Parameters:”Parameter | Description |
---|---|
None | It does not have any specific parameter. |
lscpu Command Samples:
Section titled “lscpu Command Samples:”Display CPU Information
Section titled “Display CPU Information”lscpu
Displays detailed information about the CPU.
Display Only the Architecture
Section titled “Display Only the Architecture”lscpu | grep Architecture
Displays only the architecture information of the CPU.
Display CPU Core Information
Section titled “Display CPU Core Information”lscpu | grep "Core(s) per socket"
Displays the number of CPU cores per socket.
Display CPU Thread Information
Section titled “Display CPU Thread Information”lscpu | grep "Thread(s) per core"
Displays the number of threads per CPU core.
Display CPU Clock Speed
Section titled “Display CPU Clock Speed”lscpu | grep "CPU MHz"
Displays the CPU clock speed in MHz.
Display CPU Socket Information
Section titled “Display CPU Socket Information”lscpu | grep "Socket(s)"
Displays the number of CPU sockets.
Display CPU Vendor Information
Section titled “Display CPU Vendor Information”lscpu | grep "Vendor ID"
Displays the CPU vendor information.
How do I display CPU architecture information using lscpu?
Section titled “How do I display CPU architecture information using lscpu?”To display CPU architecture information using lscpu, run the following command:
lscpu
How to show just the CPU model name with lscpu?
Section titled “How to show just the CPU model name with lscpu?”To show just the CPU model name with lscpu, use the following command:
lscpu | grep "Model name"
Can lscpu show the number of physical CPU sockets?
Section titled “Can lscpu show the number of physical CPU sockets?”Yes, to display the number of physical CPU sockets using lscpu, use the command:
lscpu | grep "Socket(s)"
How to get information about CPU cores and threads with lscpu?
Section titled “How to get information about CPU cores and threads with lscpu?”To get information about CPU cores and threads with lscpu, execute the command:
lscpu | grep -E "Core(s) per socket|Thread(s) per core"
What is the command to display CPU cache information using lscpu?
Section titled “What is the command to display CPU cache information using lscpu?”To display CPU cache information using lscpu, use the following command:
lscpu | grep -E "L1d|L1i|L2|L3"
Can lscpu provide details about CPU flags?
Section titled “Can lscpu provide details about CPU flags?”Yes, you can use lscpu to get details about CPU flags by running the command:
lscpu | grep "Flags"
Applications of the lscpu command
Section titled “Applications of the lscpu command”- Determine the number of CPUs on the system
- View information about the CPU architecture
- Display CPU vendor information
- Show CPU family, model, and stepping
- Check CPU frequency and max/min frequencies
- View CPU cache information
- Display NUMA (Non-Uniform Memory Access) information
- Show flags indicating CPU features
- Determine the endianness of the CPU
- Check the number of threads per core and cores per socket