Debian Admin - Your way to Debian World

August 24, 2007

Howto display the number of processors in Linux

by @ 7:04 am. Filed under General

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

If you’ve just bought a new desktop,laptop or server and the box says the box is powered by 2 processors, you can actually verify that.

Here’s how to display the number of processor of your linux box.

Simply issue the following command as root

# cat /proc/cpuinfo | grep processor

Everything in linux is files. This command simply retrieves the number of processors that linux detected from /proc/cpuinfo and displays it. Usually, the processor number comes at the first set of line from issuing the command.

Here’s what the command returned for me:
~~~~~~~~~~~~~~~~~~~~~~~~
processor : 0
~~~~~~~~~~~~~~~~~~~~~~~~

which means You have 1 processor with a processor ID number 0. Processor counting starts with 0.
So if you have a PC with core duo, you will probably have 2 lines that says 0 and 1.That is 2 processors.

Tags: ,

You may also be interested in...

6 Responses to “Howto display the number of processors in Linux”

  1. Lev Says:

    Ever heard of hyperthreading? If it’s on in the BIOS, it’ll incorrectly double the number…

  2. Eddie303 Says:

    Lev: I once ate that with some proliant server, it had only one CPU, and because of HyperThreading, I thought there are 2…

  3. Igor Says:

    There is a lot simpler solution. Just type ‘top’ at the command prompt and then press ‘1′ (number one).
    You will see the ACTUAL CPUs listed on the top of the page

  4. Bubax Says:

    > Simply issue the following command as root

    *Not* as root, because:
    # ls -l /proc/cpuinfo
    -r–r–r– 1 root root 0 2007-09-03 15:49 /proc/cpuinfo

    (Unless your system uses other permissions than mine, but I don’t see why it should do that.)

    Misuse of cat:
    > # cat /proc/cpuinfo | grep processor

    Simply use:
    # grep processor /proc/cpuinfo

  5. Bubax Says:

    Your script is broken:

    Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/debianad/public_html/wp-content/plugins/SK2/sk2_second_chance.php:2) in /home/debianad/public_html/wp-content/plugins/pxsmail.php on line 1

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/debianad/public_html/wp-content/plugins/SK2/sk2_second_chance.php:2) in /home/debianad/public_html/wp-content/plugins/pxsmail.php on line 1
    Thank you. Your comment has been approved.

  6. Randall Says:

    If your kernel does not have SMP support compiled in, `cat /proc/cpuinfo` will only show one processor, even if you have more than one cpu.

Leave a Reply

Subscribe RSS Feed

subscribe to the Debian Admin RSS feed

Internal links:

Sponsors:



Categories:

Support Debian Admin

Amount $:
Website(Optional):

Sponsors:

Archives:

WidgetBucks - Trend Watch - WidgetBucks.com

Related Links:


WidgetBucks - Trend Watch - WidgetBucks.com

Favourite Sites:

Wordpress Collection
Windows Reference
Ubuntu Geek
DebianHelp
All About Debian Tutorials
Power Electrical
Check Your IP Here
Debian,Ubuntu News
DebCentral
Tuxmachines
Capnkirby
Libervis
Nuxifield
Linux Horizon
Linux Appfinder
Debuntu
GNU/Linux For Everyone
Free Penguin
DebianAdmin is not related to the Debian Project.
This site is copyright © 2006,2007 Debian Admin
All Trademarks are the property of their respective owners.
The contents of this website may not be mirrored or archived without the express written permission of DebianAdmin Site Owner.

DISCLAIMER: All the information, troubleshooting methods, utilities offered in this website is provided AS-IS, without any warranties. Though I strive for perfection, and always test the validity and effectiveness of the troubleshooting content in various systems, I assume no responsibility for your use of these Fixes, Utilities and other troubleshooting advice. The author will not be liable for any special, incidental, consequential or indirect damages due to loss of data or any other reason. All use is completely at your own risk. Changes to the existing content and new additions are made to this website periodically, without notification.
Rodney's Kontera DynamiContext Plugin plugged in.