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 using uname from sorted by
Terminal - Commands using uname - 14 results
uname -p
uname -a
uname -m
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

urpmi.addmedia --update google-talkplugin http://dl.google.com/linux/talkplugin/rpm/stable/$(uname -m | sed -e "s/i.86/i386/")
2011-04-30 23:01:36
User: mpb
Functions: sed uname
0

This command adds a urpmi media source called "google-talkplugin" to the urpmi configuration on Mandriva or Mageia. Needs to be run as root. We specify the option "--update" so that when Google provides a newer version of Google Talk plugin in their download system then running a system update (eg: "urpmi --auto-update") will result in our copy of Google Talk plugin getting updated (along with any other Mandriva/Mageia pending updates).

To install Google Talk plugin from this source, use:

urpmi google-talkplugin # install plugin used for voice and video Google chat via gmail

sudo apt-get install linux-headers-$(uname -r)
uname -m
2011-01-15 21:07:13
User: retrodanny
Functions: uname
Tags: 32 processor
-4

i686 = 32 bits

x86_64 = 64 bits

the command "getconf LONG_BIT" will work just as well.

while (true); do clear; uname -n; echo ""; df -h /; echo ""; tail -5 /var/log/auth.log; echo ""; vmstat 1 5; sleep 15; done
2010-08-23 04:37:58
User: roknir
Functions: df echo sleep tail uname vmstat
1

You can use this one-liner for a quick and dirty (more customizable) alternative to the watch command. The keys to making this work: everything exists in an infinite loop; the loop starts with a clear; the loop ends with a sleep. Enter whatever you'd like to keep an eye on in the middle.

aptitude purge linux-image | grep ^i | grep -v $(uname -r)
uname -a
test `uname` = Linux && lsb_release -a || ( test `uname` = SunOS && cat /etc/release || uname -rms )
2009-07-07 20:51:30
User: virtualshock
Functions: cat test uname
-7

Found in comments section works on most Linux flavors.

rpm -q kernel-2* | grep -v $(uname -r) | xargs yum erase -y
2009-03-28 21:41:15
User: Nick
Functions: grep rpm uname xargs
1

On Fedora clean the boot directory; erase older kernel

mysql -u uname dbname -e "show tables" | grep -v Tables_in | grep -v "+" | gawk '{print "optimize table " $1 ";"}' | mysql -u uname dbname
mysql -u uname dbname -e "show tables" | grep -v Tables_in | grep -v "+" | gawk '{print "drop table " $1 ";"}' | mysql -u uname dbname