Needed a quick way to see if my server distro that I setup years ago was running 32bit or not, since with time I had forgotten. Note: does not check _hardware_ e.g. /proc/cpuinfo but rather the kernel installed Show Sample Output
This command tell you if your hardware is 32 or 64 bits even if you install a 32bits OS on a 64 bits hardware.
If your distro don't support the -q switch, try doing :
grep &>/dev/null '\<lm\>' /proc/cpuinfo && echo 64 bits || echo 32 bits
This is likely only valid on Solaris based systems. Unfortunately a lot of the more universal techniques for determining if a system is 32bit or 64bit on x86 solaris fail to give much more information than "i86pc" Show Sample Output
CPU flags: rm --> 16-bit processor (real mode) tm --> 32-bit processor (? mode) lm --> 64-bit processor (long mode)
Let's you examine, for example, whether infrastructure folks really provisioned the correct setup.
Java 64-bit checklist
1. check if hardware is 64-bit capable by looking for lm flag
grep -l 'flags.*\<lm\>' /proc/cpuinfo
2. check if kernel is 64-bit
getconf LONG_BIT | grep '64'
3. check if java is 64-bit (simply look for 64-bit in output - if present, then it is, if absent, then it is 32-bit)
java -version
Show Sample Output
Avoids cat abuse ;)
Display the machine "hardware name" 32 or 64 bit.
"x86_64" is shown on 64 bit machines
"i686" is typically shown on 32 bit machines (although, you might also see "i386" or "i586" on older Linuxen).
On other "unix-like" systems, other hardware names will be displayed.
For example, on AIX, "uname -m" gives the "machine sequence number".
For whatever reason, IBM decided that "uname -M" would give the machine type and model.
(ref: http://www.ibm.com/developerworks/aix/library/au-aix-systemid.html )
On Sun Solaris, "uname -m" can be used to determine the chip type and "isainfo -v" will reveal
if the kernel is 64 or 32 bit.
(ref: http://www.ibiblio.org/pub/packages/solaris/sparc/html/32.and.64.bit.packages.html )
A more reliable way to determine "64-bit ness" across different Unix type systems is to compile the following simple C program:
cat <<eeooff > bits.c
/*
* program bits.c
* purpose Display "32" or "64" according to machine type
* written January 2013
* reference http://www.unix.org/whitepapers/64bit.html
*/
/* hmm, curious that angle-brackets removed by commandlinefu.com data input processing? */
#include "/usr/include/stdio.h"
long lv = 0xFFFFFFFF;
main ( ) {
printf("%2d\n",(lv < 0)?32:64);
}
eeooff
Compile and run thusly: cc -o bits bits.c; ./bits
Show Sample Output
CPU flags: rm --> 16-bit processor (real mode) tm --> 32-bit processor (? mode) lm --> 64-bit processor (long mode)
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.
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
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: