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.

Universal configuration monitoring and system of record for IT.
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

Hide

Credits

Produce a pseudo random password with given length in base 64

Terminal - Produce a pseudo random password with given length in base 64
date +%s | sha256sum | base64 | head -c <length>; echo
2010-04-30 22:05:11
User: markdrago
Functions: date head
2
Produce a pseudo random password with given length in base 64

Alternatives

There is 1 alternative - vote for the best!

Terminal - Alternatives
openssl rand -base64 <length>
2010-05-01 13:09:42
User: buzzy
5

Don't copy trailing '=' or use head -c to limit to desired length.

perl -MDigest::SHA -e 'print substr( Digest::SHA::sha256_base64( time() ), 0, $ARGV[0] ) . "\n"' <length>
2010-04-30 21:45:46
User: udog
Functions: perl
1

Of course you will have to install Digest::SHA and perl before this will work :)

Maximum length is 43 for SHA256. If you need more, use SHA512 or the hexadecimal form: sha256_hex()

Know a better way?

If you can do better, submit your command here.

What others think

uncomplicated, effective and understandable to even a novice. this is the caliber what commandlinefu should asipre to when posting commands.

Comment by vxbinaca 274 weeks and 1 day ago

This is a risky command: if someone, more or less, knows when you used this command he can easy brute force your password... Don't use it.

Comment by buzzy 274 weeks ago

The date isn't random. This is stupid.

Comment by Carpetsmoker 40 weeks and 3 days ago

Your point of view

You must be signed in to comment.