1

If kernel type (64/32) is no indication of what bit your distribution is, how do I know what I'm running? I'm on Ubuntu, and I just found out, to my surprise, you can use a 64 bit kernel on a 32 bit Linux distribution... so how can I tell for sure what type of software I'm running, 64 bit or 32 bit?

Victor S
  • 243
  • 2
  • 7

4 Answers4

2

Just run this on the command line

getconf LONG_BIT

It will return 32 or 64

Knoxy
  • 58
  • 5
1
cat /proc/version
cat /etc/issue
uname -a

in the terminal should display helpful information to clarify what you're running on any given machine.

I would say it is very rare that you would have a kernel that is set up out of sync with the software of the distro as a whole, certainly I've never come across anyone who configured it that way, so generally you can expect x86_64 to represent a 64 bit operating system and kernel pretty much whenever you encounter it.

Since you are in ubuntu, for any given bit of software you can simply run:

apt-cache policy <packagename>

and look for the telltale signs, for example my results for skype:

apt-cache policy skype
skype:
  Installed: 4.2.0.11-0ubuntu0.12.04.1
  Candidate: 4.2.0.11-0ubuntu0.12.04.1
  Version table:
 *** 4.2.0.11-0ubuntu0.12.04.1 0
        500 http://archive.canonical.com/ubuntu/ precise/partner amd64 Packages
        100 /var/lib/dpkg/status
Knoxy
  • 58
  • 5
Kzqai
  • 1,278
  • 4
  • 17
  • 32
1

With a 32-bit kernel, you know all applications must be 32-bit. With a 64-bit kernel, there can be any mix of 32-bit and 64-bit applications and libraries. You have to check the applications you care about to see what type they are. You can use the file command to check the bitness of a library or executable.

David Schwartz
  • 31,215
  • 2
  • 53
  • 82
1

If you can't remember any of the others, and I can't, then the following 'trick' works, just print the length of a pointer in C/C++:

#include <iostream>
using namespace std;

int main( int argc, char *argv[] ) {
    cout << sizeof( void *) << endl;
    return 0;
}

This will give '4' on 32-bit os (ie 4 bytes = 32 bits), and '8' on 64-bit os (ie 8 bytes, = 64 bits).

Hugh Perkins
  • 1,065
  • 7
  • 9