22.6 C
Tuesday, May 18, 2021

How to Use Linux lscpu Command Tutorial – Linux Hint

Must read

The beauty of Linux-like systems is that it provides multiple command-line tools for a single operation. Whether you want to download software/packages or fetch any information from hardware/disk drives of the system, you will get several ways according to your needs while using Linux.

A command-line utility “lscpu” in Linux is used to get CPU information of the system. The “lscpu” command fetches the CPU architecture information from the “sysfs” and /proc/cpuinfo files and displays it in a terminal.

The syntax of the “lscpu” command is mentioned below:

How to use the “lscpu” command in Linux:

Execute the “lscpu” command without invoking any argument in the terminal to display the complete picture of useful information about the processor:

lscpu Command Options:

The list of several options providing by the “lscpu” command tool is listed below:

To display in Human Readable Format:

In the “lscpu” command, there is an option to display output that is understandable for the user.

Run the “-e” option in the terminal; it will gather CPU related data and display it in Human Readable Format:

Also, if you want to limit the output with the particular column, then use the “-e” option with the column name:

Display in Parsing-friendly Format:

To display the processor information in a parsing-friendly format, use the “-p” option:

Hexadecimal Masks for CPU Sets:

When we execute the “lscpu” command, it displays output in list format by default, but you can use the hexadecimal mask to print CPU sets using the “-x” option:

Display in JSON Format:

The “lscpu” command also allows to print the extended output of CPU information in JSON format through the “-J” option:

Offline and Online CPU list:

The output can also be limited with the summary of the online and offline CPU list by using the “-e” and “-p” options:

  1. The “-b” flag for the list of online CPUs.
  2. The “-c” flag for the list of offline CPUs.

These flags will run only with the execution of “-e” and “-p” options.

Such as, if you want to print the results only for online CPUs, run the given command in a terminal:

Display Help:

To print a help message regarding the “lscpu” command and its options, use the “-h” option:

Display Version:

Run the “-V” option in a terminal to print version of the “lscpu” command tool:


The “lscpu” command is a Linux tool used to fetch CPU-related information from the sysfs files and display the output in the terminal.

This guide has discussed the “lscpu” command tool and its usage with multiple functions.

Source link

- Advertisement -

More articles


Please enter your comment!
Please enter your name here

- Advertisement -

Latest article