32 bits or 64 bits?

getconf LONG_BIT
Easy and direct way to find this out.
Sample Output

By: caiosba
2009-08-08 21:22:19

11 Alternatives + Submit Alt

What Others Think

Does this return the system's capability or merely its current configuration? I ask because on the new box I recently built to learn with, it reported only 32-bit but I assume it's be 64-bit-capable. (I know this also depends on what version of the OS I installed so I'll do a little more digging on that too since I don't remember offhand.)
bithaze · 632 weeks and 2 days ago
I've run this command on many different systems including Linux, SunOS, etc, and it works great. I've yet to find a POSIX based system it doesn't work on. I just saw the alternative, 'arch' command and that seems to work good too, but that will output x86 or x86_64 not an integer with the number of bits. As for looking at /proc/cpuinfo, that will just tell you what your processor is capable of. A lot of times, you'll find a system that is running a 32 bit OS but has a 64 bit processor. So, I would avoid getting details on the processor itself if what you really want to know what your OS is supporting. I suspect that some of the other alternatives might just be checking CPU hardware and not the OS. I'll stick with getconf LONG_BIT, although now that I know the arch command exists, I'll see if it works on all POSIX systems like the getconf LONG_BIT command seems to.
sonic · 326 weeks ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: