Language Selection

English French German Italian Portuguese Spanish

Counting processors on your Linux box

Filed under
Linux
HowTos

Ever since the /proc file system first made an appearance on Unix systems, getting information on running processes became a whole lot easier. The useful, but too often insufficient information available in the output of ps commands was thoroughly upstaged by /proc which acts as an interface to kernel data structures. /proc provides interfaces to kernel data structures that can supply information on how memory is being used, what devices are mounted, which file descriptors are in use, and what command line arguments were used with running processes -- and that's just a start. On Linux systems, /proc also contains information on the system's processors. It sits in a file called cpuinfo.

To find out how many processors you have, for example, look through /proc/cpuinfo for lines containing the string "physical id". You can grab this with grep and then pass that information through a couple handy filters like this to get a count:

rest here




More in Tux Machines

Red Hat News

Kernel Space/Linux

today's howtos

Ten Years as Desktop Linux User: My Open Source World, Then and Now

I've been a regular desktop Linux user for just about a decade now. What has changed in that time? Keep reading for a look back at all the ways that desktop Linux has become easier to use -- and those in which it has become more difficult -- over the past ten years. I installed Linux to my laptop for the first time in the summer of 2006. I started with SUSE, then moved onto Mandriva and finally settled on Fedora Core. By early 2007 I was using Fedora full time. There was no more Windows partition on my laptop. When I ran into problems or incompatibilities with Linux, my options were to sink or swim. There was no Windows to revert back to. Read more