Monday, March 26, 2012

Detecting 32-bit/64-bit Processor using Linux

When I first got my laptop, I barely knew about about it's architecture, processor bits and type. So I was left undecided as to what type of operating system should be installed and I wasnt that brave enough too to open up my brand new laptop and have a peek inside just to see the processor details (I know that sounds so lame).

Though we are all familiar with the various companies that manufacture processors (32-bit and 64-bit) like Intel, AMD, VIA, Sun Microsystems (SPARC), IBM (PowerPC), HP (PA-RISC) etc, but we normally have Intel and AMD processors inside our desktops and laptops.

The 32-bit and 64-bit refer to the size of memory (the memory registers) in a processor. This is what actually defines the amount of data the processor can handle in a single operation. A 32-bit processor limits the memory theoretically to 4GB. So if your operating system is 32-bit you cannot access the physical memory larger than 4GB unless you have installed an operating system that supports PAE (Physical Address Extension). Many Linux distros now provide pae support in their kernels, whereas we need to install pae related package in Ubuntu 11.10. Below mentioned is the command to get the package for support for more than 4GB memory.
$ sudo apt-get install linux-generic-pae
This will practically will give you access to more than 4GB physical memory.

Even though we have a 64-bit processor still we can install a 32-bit operating system, but the vice-versa is not possible. I would recommend you to go for a 64-bit operating system if you have a 64-bit processor unless you have a specific to choose 32-bit. The reason is quite simple and straight. If you are into some heavy work and intensive tasks like encoding videos and audios then 64-bit operating system is the best bet.
The only problem that you would encounter is the lack of 64-bit device drivers. In that case here I would recommend you to use open source community based operating systems as they are highly scalable. One such operating system is Ubuntu. Due to large community support it is capable to support almost any x86 hardware and 32/64-bit processors.

Being some what familiar to UNIX, I decided to go for a Ubuntu 11.10 Live CD and find out bits my processor supports.


Detecting processor bit

Using cpuinfo file
$ grep -w lm /proc/cpuinfo
If this highlights "lm" it means the processor is 64-bit else 32-bit.

Using lshw command
If you already have a ubuntu linux operating system installed you just need to run lshw command. To run that you need to have lshw package installed on your operating system. Install the package using the below mentioned command.
$ sudo apt-get install lshw

Now run the below command
$ sudo lshw | grep "description: CPU" -A 12 | grep width

My laptop's output is 64-bits which is self explanatory for a 64-bit processor.

Using lshw GUI
The lshw package also provides the graphical interface. Run the below command to open a GUI window.
$ sudo lshw -X

As you can see that my laptop is having Intel Core i3 CPU M350 @ 2.27GHz whose 'width' is 64 bits i.e. the processor is 64-bit.

Using getconf
The getconf command queries the system configuration.
$ getconf LONG_BIT

If the output is just 64, it refers to 64-bit processor

Detecting Operating System bit

To find out whether the operating system installed is 32-bit or 64-bit, run the below command.
$ uname -m

If it takes out the output as i386 to i686 then the operating system is 32-bit.
And if it shows x86_64 it means 64-bits.

Detecting 32-bit mode or 64-bit mode Solaris 10

64-bit mode SPARC processor

$ isainfo -v

64-bit sparcv9 applications

$ isainfo -b
The -b option prints the number of bits in the address space of the native instruction set. In this case, 64 bits.

$ isainfo -kv
64-bit sparcv9 kernel modules
The -k option prints the name of the instruction set used by the operating system kernel components, i.e. sparcv9; -v provides more detailed information, i.e. 64-bit sparcv9.

64-bit mode Intel/AMD

$ isainfo -v

64-bit amd64 applications
sse4.1 ssse3 cx16 mon sse3 sse2 sse fxsr mmx cmov amd_sysc cx8 tsc fpu
32-bit i386 applications
sse4.1 ssse3 cx16 mon sse3 sse2 sse fxsr mmx cmov sep cx8 tsc fpu

$ isainfo -b

$ isainfo -kv
64-bit amd64 kernel modules

64-bit mode Solaris 10
$ echo "Welcome to "`isainfo -b`"-bit Solaris"
Welcome to 64-bit Solaris

32-bit hardware will give out 32 in place of 64 in all the above commands.

Brief History
- 8086 & 8088, 1st gen
- 80286, 2nd gen
- i386 (80386), 3rd gen
- i486 (80486), 4th gen
- i586 (Intel Pentium & AMD K5), 5th gen
- i686 (Intel Pentium Pro, II and AMD K6), 6th gen
- i786 (Intel Pentium III & 4, AMD Athlon, Duron & Sempron), 7th gen
- i886 (Intel Pentium 4 and AMD Opteron & Athlon64), 8th gen
Later generations are no longer referred to i786 & i886, now they have their own different naming conventions. The "i" stands for Intel.

All the snapshots shown above are for my HP Probook 4420s laptop with Intel i3 processor. Hence, all outputs show 64-bit.
As you can see these are all little commands which make our lives easier and not at all so frightening as most of us think.

Let us share. Make Linux easier & fun for all.


  1. hey Bro....!what's up...?when you will be come back...?

  2. Thanks. A command for both informations here:

    We can also run ...
    … and have a look just to the first 2 lines of the output:
    “Architecture” informs about the installed Linux version: "i686" represents one of 32 bits, while "x86_64" stands for a 64 bits one.
    "CPU op-mode(s)" informs about the CPU. "32-bit" represents one of 32 bits, while "32-bit, 64-bit" or "64-bit" stands for a 64 bits one.