1

I am trying to figure out the list of possible ways to find out if a Linux machine is 32 bit or 64 bit.

Method 1:

The command uname -m will specify if my machine is 32 bit or 64 bit.

Method 2:

I can run the command getconf LONG_BIT to find if it is 32 bit or 64 bit.

Method 3:

I can check for the lm bit in the /proc/cpuinfo file. If that bit is not set, then I can say my machine is a 32 bit machine.

Which of the above methods is the more accurate way of telling if my machine is a 32 bit machine or 64 bit machine? Or is there any other efficient way/command to find out the same?

6
  • 1
    See my answer to this U&L Q&A: unix.stackexchange.com/questions/77718/…. Your question is a duplicate to that one. – slm Oct 29 '13 at 21:35
  • yeah, I was going through your question only. But the list of commands you had specified such as lscpu, hwinfo, lshw were not working on RHEL. So, I wanted to know if there are more ways in RHEL. – Ramesh Oct 29 '13 at 21:40
  • all those tools can be installed on RHEL, I did that work on a mix of Fedora/CentOS boxes. – slm Oct 29 '13 at 21:41
  • oh ok. I will try installing those tools. Thanks for the information. – Ramesh Oct 29 '13 at 21:41
  • 1
    the method Joel suggests below is also covered in that answer, and doesn't require any additional software to be installed. It's looking at a Kernel structure /proc/cpuinfo and simply parsing it. – slm Oct 29 '13 at 21:44
4

cpuinfo is the most reliable way since you're checking CPU characteristics. uname returns kernel traits and getconf is compilation dependant.

5
  • 2
    That's cat /proc/cpuinfo right Joel? This method is covered in the link I provided to him as well. The answer I gave over there is exhaustive, better to link to it. – slm Oct 29 '13 at 21:41
  • @Ramesh - yes I fixed it after you saw it. 8-) – slm Oct 29 '13 at 21:44
  • @slm damn it, I didn't see where you had posted until just now. Should this question be marked as a duplicate of the other? I don't care too much about the points so if it takes it away oh wells, I just won't do as many bounties (about the only thing they're particularly useful for as far as I can tell). – Bratchley Oct 29 '13 at 22:39
  • OK well disregard that last comment because you guys are all over it. So I guess that makes two in a row. Next time I'll try to be a little less impulsive just so I don't complete the trifecta of barreling ahead heedlessly. Sorry about that. – Bratchley Oct 29 '13 at 22:40
  • @JoelDavis - it's fine to answer, someone will ultimately find the duplicate. I +1 you since it was the right answer as far as being the most accessible w/o installing other tools. – slm Oct 29 '13 at 23:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.