lscpu Command Examples in Linux

lscpu command gives us information about our processor’s architecture, which operation mode the processor is currently using, the byte order, how many processors we’re running, how many cores, and so on.

In an active Terminal session, type the following command:

$ lscpu

The following screenshot is the result of running lscpu on my 32-bit virtual machine:

lscpu Command Examples

1. To get the CPU architecture:

# lscpu 

2. To get the lscpu help:

# lscpu -h
# lscpu --help 

3. To find the number of sockets run the following:

# lscpu | grep -i 'socket'

4. To print the output in parsable format:

# lscpu -p
# lscpu --parse 

You can also find similar information in the file /proc/cpuinfo. For example, to find the number of cores run the following command:

# grep "physical id" /proc/cpuinfo | sort | uniq | wc -l
Related Post