Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. 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.


If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Hide

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:

Hide

News

2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.
Hide

Tags

Hide

Functions

Commands tagged 64bit from sorted by
Terminal - Commands tagged 64bit - 10 results
grep " lm " /proc/cpuinfo > /dev/null && echo "64-bit" || echo "32-bit"
uname -m
cat /proc/cpuinfo | grep " lm " > /dev/null && echo 64 bits || echo 32 bits
2013-02-11 22:54:26
User: agd
Functions: cat echo grep
1

CPU flags:

rm --> 16-bit processor (real mode)

tm --> 32-bit processor (? mode)

lm --> 64-bit processor (long mode)

if [[ lm = $(cat /proc/cpuinfo | grep " lm ") ]] ; then echo "64 bits" ; else echo "32 bits" ; fi
2013-02-11 22:40:46
User: agd
Functions: cat echo grep
-4

CPU flags:

rm --> 16-bit processor (real mode)

tm --> 32-bit processor (? mode)

lm --> 64-bit processor (long mode)

grep -q '\<lm\>' /proc/cpuinfo && echo 64 bits || echo 32 bits
2013-02-09 13:01:36
User: sputnick
Functions: echo grep
1

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
uname -m # display machine "hardware name"
2013-01-04 11:46:43
User: mpb
Functions: uname
-4

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

isainfo -v
2013-01-04 03:07:28
User: halcyonblue
1

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"

arch
grep -l 'flags.*\<lm\>' /proc/cpuinfo && (getconf LONG_BIT | grep '64') && java -version
2012-12-17 16:39:55
Functions: getconf grep
Tags: java 32bit 64bit
0

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
getconf LONG_BIT
2012-12-12 23:51:51
User: varghjarta
Functions: getconf
20

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