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.


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.

UpGuard checks and validates configurations for every major OS, network device, and cloud provider.
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

May 19, 2015 - A Look At The New Commandlinefu
I've put together a short writeup on what kind of newness you can expect from the next iteration of clfu. Check it out here.
March 2, 2015 - New Management
I'm Jon, I'll be maintaining and improving clfu. Thanks to David for building such a great resource!
Hide

Top Tags

Hide

Functions

Generat a Random MAC address

Terminal - Generat a Random MAC address
MAC=`(date; cat /proc/interrupts) | md5sum | sed -r 's/^(.{10}).*$/\1/; s/([0-9a-f]{2})/\1:/g; s/:$//;'`
2009-02-16 07:09:43
User: vaporub
Functions: cat md5sum sed
17
Generat a Random MAC address

Original author unknown (I believe off of a wifi hacking forum).

Used in conjuction with ifconfig and cron.. can be handy (especially spoofing AP's)

Alternatives

There are 2 alternatives - vote for the best!

Terminal - Alternatives
openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'
2010-09-23 02:31:12
User: putnamhill
Functions: sed
Tags: sed xxd openssl
15

Use the following variation for FreeBSD:

openssl rand 6 | xxd -p | sed 's/\(..\)/\1:/g; s/:$//'
hexdump -n6 -e '/1 ":%02X"' /dev/random|sed s/^://g
2015-01-19 03:09:43
User: rubo77
Functions: hexdump sed
3

Generate a random MAC address with capital letters

od -An -N10 -x /dev/random | md5sum | sed -r 's/^(.{10}).*$/\1/; s/([0-9a-f]{2})/\1:/g; s/:$//;'
od /dev/urandom -w6 -tx1 -An|sed -e 's/ //' -e 's/ /:/g'|head -n 1
2011-05-16 15:05:34
User: karel1980
Functions: head od sed
2

Just increase the 1 at the end if you want to generate more than one.

(Alternative to "| head -n N" you could use the -b flag of od: -b $[6*N]

while ( true ) ; do if [ $(expr $RANDOM % 2 ) -eq 0 ] ; then echo -ne "\xE2\x95\xB1" ; else echo -ne "\xE2\x95\xB2" ; fi ; done
2015-01-17 12:46:37
User: tobi
Functions: echo expr true
2

Generates labyrinth-like pattern on UTF-8 terminal in bash.

For fun ;)

Know a better way?

If you can do better, submit your command here.

What others think

The current top example (by vaporub) generates an invalid MAC address (should be six groups of two hexadecimal digits). Just use 12 in the regex instead:

MAC=`(date; cat /proc/interrupts) | md5sum | sed -r 's/^(.{12}).*$/\1/; s/([0-9a-f]{2})/\1:/g; s/:$//;'`
Comment by aorth 291 weeks and 2 days ago

Beware, completely random MACs are not guaranteed to be "unicast"

Comment by outly3r 267 weeks and 6 days ago

It is http://www.huaracherunpas-cher.fr/huarache-leopard_77.html said that will http://www.huaracherunpas-cher.fr/chaussure-huarache-nike_173.html participating in some pockets on the http://www.huaracherunpas-cher.fr/nike-air-huarache-mid_78.html course is usually http://www.huaracherunpas-cher.fr/nike-air-huarache-prix_120.html one of the best http://www.huaracherunpas-cher.fr/huarache-light_50.html difficult fits of the video game. http://www.huaracherunpas-cher.fr/air-huarache-og_71.html Not only do http://www.huaracherunpas-cher.fr/huarache-light-og_105.html you must have a http://www.huaracherunpas-cher.fr/nike-huarache-prix_66.html wide range of http://www.huaracherunpas-cher.fr/nike-air-huarache-beige_112.html tolerance, in addition, you need a http://www.huaracherunpas-cher.fr/nike-huarache-gris_59.html great deal http://www.huaracherunpas-cher.fr/nike-huarache-id_164.html of content level. It http://www.huaracherunpas-cher.fr/huarache-usa_100.html doesn't matter how well http://www.huaracherunpas-cher.fr/nike-huarache-boutique_147.html you play in the recreation http://www.huaracherunpas-cher.fr/nike-huarache_93.html , there's always something that http://www.huaracherunpas-cher.fr/huarache-5_74.html you could improve upon. http://www.huaracherunpas-cher.fr/nike-huarache-fille_148.html Another thing that http://www.huaracherunpas-cher.fr/huarache-og_183.html may impact the method http://www.huaracherunpas-cher.fr/air-huarache-grise_142.html an individual perform ' http://www.huaracherunpas-cher.fr/nike-huarache-free-run-2012_146.html s what anyone dress in. If http://www.huaracherunpas-cher.fr/nike-huarache-femme-pas-cher_140.html however you put http://www.huaracherunpas-cher.fr/huarache-beige_106.html on outfits and http://www.huaracherunpas-cher.fr/nike-air-huarache-turquoise_160.html also the game of golf http://www.huaracherunpas-cher.fr/air-flight-huarache_68.html shoes and boots http://www.huaracherunpas-cher.fr/nike-air-huarache-og-retro_101.html that aren't really captivating and http://www.huaracherunpas-cher.fr/air-huarache-solde_40.html also at ease, then http://www.huaracherunpas-cher.fr/basket-huarache_63.html you might wind up dealing http://www.huaracherunpas-cher.fr/nike-air-huarache-og_162.html with various other http://www.huaracherunpas-cher.fr/nike-huarache-agassi_133.html troubles that will impact the http://www.huaracherunpas-cher.fr/huarache-2017_99.html sport while you http://www.huaracherunpas-cher.fr/nike-air-huarache-original_144.html are around the course. Take time http://www.huaracherunpas-cher.fr/nike-air-huarache-light-pas-cher_44.html and energy to http://www.huaracherunpas-cher.fr/huarache-free-run_145.html dress yourself in a http://www.huaracherunpas-cher.fr/air-nike-huarache_107.html way that enables you http://www.huaracherunpas-cher.fr/nike-huarache-3_108.html to move freely and http://www.huaracherunpas-cher.fr/nikeair-huarache_88.html adequately. Do not http://www.huaracherunpas-cher.fr/nike-huarache-2_166.html make the oversight http://www.huaracherunpas-cher.fr/air-huarache-noir_116.html with thinking since video game will http://www.huaracherunpas-cher.fr/huarache-noir-femme_60.html involve an individual utilizing your http://www.huaracherunpas-cher.fr/nike-air-huarache-homme_150.html biceps and http://www.huaracherunpas-cher.fr/huarache-nike-blanche_127.html triceps, next all http://www.huaracherunpas-cher.fr/nike-huarache-paris_69.html you need to be concerned about http://www.huaracherunpas-cher.fr/huarache-acheter_83.html is the best t http://www.huaracherunpas-cher.fr/air-huarache-light_139.html shirts. You employ quite a http://www.huaracherunpas-cher.fr/huarache-og-2017_143.html number of distinct http://www.huaracherunpas-cher.fr/free-huarache_103.html muscles within this http://www.huaracherunpas-cher.fr/air-huarache-nike_87.html sport. From a person's http://www.huaracherunpas-cher.fr/huarrache-blanche_135.html feet to your disposal is very http://www.huaracherunpas-cher.fr/chaussures-air-huarache_128.html important. It would http://www.huaracherunpas-cher.fr/nike-huarache-free-run-pas-cher_156.html be extremely tough http://www.huaracherunpas-cher.fr/huarache-run_132.html so you might concentrate if http://www.huaracherunpas-cher.fr/nike-huarache-pour-femme_155.html you are concerned about many http://www.huaracherunpas-cher.fr/chaussure-nike-air-huarache_76.html areas http://www.huaracherunpas-cher.fr/huarache-noir_86.html of the body. Should your feet http://www.huaracherunpas-cher.fr/huarache-nike-chaussures_131.html harmed while you are http://www.huaracherunpas-cher.fr/nike-huarache-leopard_57.html endeavoring to http://www.huaracherunpas-cher.fr/nike-air-huarache-noir_97.html focus on the activity, in that case http://www.huaracherunpas-cher.fr/huarache-nike-noir_149.html just how well http://www.huaracherunpas-cher.fr/huarache-montante_179.html can someone http://www.huaracherunpas-cher.fr/nike-huarache-usa_114.html have fun with? This is why http://www.huaracherunpas-cher.fr/huarache-femmes_170.html you'll want http://www.huaracherunpas-cher.fr/air-huarache-femme_90.html to purchase a rugged http://www.huaracherunpas-cher.fr/nike-huarache-marron_165.html pair of the game of golf http://www.huaracherunpas-cher.fr/nike-air-huarache-pas-chere_161.html shoes. You might want to http://www.huaracherunpas-cher.fr/nike-huarache-noir-et-bleu_130.html pay http://www.huaracherunpas-cher.fr/nike-air-huarache-light_168.html back additional intended for excellent though http://www.huaracherunpas-cher.fr/nike-huarache-taille_49.html the rewards you may http://www.huaracherunpas-cher.fr/nike-huarache-toute-noir_154.html practical experience may be http://www.huaracherunpas-cher.fr/nike-air-huarache-retro_70.html the largest go back with http://www.huaracherunpas-cher.fr/nike-huarache-magenta_51.html that investment. http://www.huaracherunpas-cher.fr/nike-huarache-blanc_85.html It just isn't difficult http://www.huaracherunpas-cher.fr/nike-huarache-run_72.html to search for the very http://www.huaracherunpas-cher.fr/nike-air-huarache-taille_172.html best golf shoes http://www.huaracherunpas-cher.fr/ or boots. There are several http://www.huaracherunpas-cher.fr/nike-huarache-1991_55.html brands who have a http://www.huaracherunpas-cher.fr/huarache-chaussures_95.html title for producing fine http://www.huaracherunpas-cher.fr/nike-air-huarache-1991_65.html quality items. Really http://www.huaracherunpas-cher.fr/nike-huarache-safari_52.html don't feel that in http://www.huaracherunpas-cher.fr/huarache-bleu_111.html the event one http://www.huaracherunpas-cher.fr/chaussure-air-huarache_180.html thing incorporates a big selling price that http://www.huaracherunpas-cher.fr/air-huarache-blanc_123.html it's immediately high-quality. You http://www.huaracherunpas-cher.fr/nike-air-huarache-2_92.html ought to do http://www.huaracherunpas-cher.fr/huarache-enfant_62.html some study so that http://www.huaracherunpas-cher.fr/boutique-nike-huarache_151.html you can http://www.huaracherunpas-cher.fr/nike-huarache-premium_126.html find our about the makes that http://www.huaracherunpas-cher.fr/nike-air-huarache-solde_181.html are offered. Request several of http://www.huaracherunpas-cher.fr/achat-nike-huarache_137.html your buddies http://www.huaracherunpas-cher.fr/nike-huarache-beige_91.html by what they could recommend so http://www.huaracherunpas-cher.fr/nike-id-huarache_158.html that you can don. http://www.huaracherunpas-cher.fr/nike-huarache-rouge_81.html Discover what brands http://www.huaracherunpas-cher.fr/nike-huarache-2013_159.html they've already wish http://www.huaracherunpas-cher.fr/basket-nike-huarache_45.html using. Search online and http://www.huaracherunpas-cher.fr/nike-huarache-chaussures_129.html also perform some research. The http://www.huaracherunpas-cher.fr/nike-air-flight-huarache_102.html end result http://www.huaracherunpas-cher.fr/nike-air-huarache-blanche_153.html is you may have http://www.huaracherunpas-cher.fr/nike-huarache-noir-et-rose_58.html to research unique models before you http://www.huaracherunpas-cher.fr/nouvelle-nike-huarache_82.html come up http://www.huaracherunpas-cher.fr/nike-huarache-solde_94.html with a good conclusion with regards http://www.huaracherunpas-cher.fr/nike-huarache-run-pas-cher_61.html to which will brand http://www.huaracherunpas-cher.fr/huarache-air-max_163.html names you http://www.huaracherunpas-cher.fr/huarache-noir-et-rose_109.html should get.Keep as the primary goal http://www.huaracherunpas-cher.fr/huarache-noir-et-blanc_96.html of which the sport http://www.huaracherunpas-cher.fr/nike-air-huarache-light-ultramarine-og_75.html of golf http://www.huaracherunpas-cher.fr/huarache-chaussure_122.html shoes or boots are http://www.huaracherunpas-cher.fr/nike-air-zoom-huarache_89.html available a variety of http://www.huaracherunpas-cher.fr/huarache-nike-pas-cher_79.html designs and colors. No matter what http://www.huaracherunpas-cher.fr/nike-air-huarache-bleu_167.html you choose to http://www.huaracherunpas-cher.fr/nike-air-huarache-chaussures_80.html use, you will discover http://www.huaracherunpas-cher.fr/nike-huarache-jd_46.html the best sneaker http://www.huaracherunpas-cher.fr/huarache-bordeaux_53.html to compliment the item. http://www.huaracherunpas-cher.fr/air-max-huarache_39.html There are several different types of http://www.huaracherunpas-cher.fr/nike-air-huarache-run-pas-cher_98.html tennis boots and http://www.huaracherunpas-cher.fr/nike-air-flight-huarache-og_48.html shoes that you should http://www.huaracherunpas-cher.fr/nike-air-huarache-run-chaussures_174.html pick from. Whenever http://www.huaracherunpas-cher.fr/huarache-instagram_169.html you have time, take a trip http://www.huaracherunpas-cher.fr/nike-air-force-1-huarache_113.html to a number http://www.huaracherunpas-cher.fr/air-huarache-homme_67.html of distinct stores you http://www.huaracherunpas-cher.fr/huarache-vintage_42.html should taking a look at http://www.huaracherunpas-cher.fr/nike-air-huarache-run_43.html their particular http://www.huaracherunpas-cher.fr/nike-huarache-ultramarine_125.html selection of products. Test http://www.huaracherunpas-cher.fr/chaussures-huarache_56.html out distinctive twos to http://www.huaracherunpas-cher.fr/nike-air-max-huarache-hybrid_121.html see how good you appear with http://www.huaracherunpas-cher.fr/nike-huarache-femmes_182.html them. A lot of http://www.huaracherunpas-cher.fr/nike-huarache-light-ultramarine_171.html suppliers have a http://www.huaracherunpas-cher.fr/nike-air-huarache-rouge_47.html generous refund guarantee. Purchase a number http://www.huaracherunpas-cher.fr/acheter-huarache_84.html of twos and try http://www.huaracherunpas-cher.fr/nike-huarache-free-light_134.html these http://www.huaracherunpas-cher.fr/nike-huarache-light-og_115.html individuals out on this course. http://www.huaracherunpas-cher.fr/nike-huarache-violet_54.html See how comfortable they think http://www.huaracherunpas-cher.fr/chaussures-huarache-nike_152.html in your legs. Upon http://www.huaracherunpas-cher.fr/nike-air-huarache-light-ultramarine_64.html having gotten to http://www.huaracherunpas-cher.fr/air-huarache-paris_138.html find out all of them http://www.huaracherunpas-cher.fr/air-huarache-run_157.html out, if you http://www.huaracherunpas-cher.fr/air-huarache-noire_117.html feel that many http://www.huaracherunpas-cher.fr/nike-air-huarache-international_104.html are a hardship on you http://www.huaracherunpas-cher.fr/nike-air-huarache-blanc_41.html to definitely enjoy http://www.huaracherunpas-cher.fr/nike-air-huarache-safari_73.html inside, send them back. Prior to http://www.huaracherunpas-cher.fr/huarache-4_118.html use on just about http://www.huaracherunpas-cher.fr/nike-air-force-huarache_124.html any study http://www.huaracherunpas-cher.fr/nike-air-huarache-90_110.html course, ensure that you possess the pair http://www.huaracherunpas-cher.fr/nike-huarache-homme_141.html you want on your own ft . so you can have a good game.

Comment by scott154 8 weeks ago

Your point of view

You must be signed in to comment.