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/
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.
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:
Prepending
env LC_CTYPE=C
fixes a problem with bad bytes in /dev/urandom on Mac OS X
So I use OSX and don't have the shuf command. This is what I could come up with.
This command assumes /usr/share/dict/words does not surpass 137,817,948 lines and line selection is NOT uniformly random.
just change 6 to 9 or 12 or more (multiple of 3) to have bigger password
Permit to generate a password for userPassword in ldap.
Use ?slappasswd -g? to generate a random passowrd.
A slightly shorter version. Also doesn't put a return character at the end of the password
If you do not have shuf or an -R option in sort, you can fall back on awk. This provides maximum portability IMO. The command first collects words from the dictionary that match the criteria - in this case: lower case words with no punctuation that are 4 to 8 characters long. It then prints 4 random entries. I decided to print each word on a separate line to improve readability.
/dev/urandom relies on operator input to set the random seed. By itself, this may not contain enough random bits to produce high entropy output, especially if the system was recently restarted. Therefore, key stretching through a hash reduces the risk of using low-entropy output as a security key.
It will produce passwords with length of 20 printable characters within a reasonable time.
For shorter or longer passwords just change the 20 in bs=20 to something more convenient.
To create only alpha numeric passwords change [:print:] to [:alnum:]
Replace < pw-length > with the desired password-length.
The password-length is not always correct, but wayne...
A more robust password creation utility
# Create passwords in batch
makepasswd --char=32 --count=10
# To learn more about the options you can use
man makepasswd
/dev/urandom relies on operator input to set the random seed. By itself, this may not contain enough random bits to produce high entropy output, especially if the system was recently restarted. Therefore, key stretching through a hash reduces the risk of using low-entropy output as a security key.
eliminates "l" and "o" characters change length by changing 'x' here: cut -c 1-x
This uses urandom to produce a random password. The random values are uuencoded to ensure only printable characters. This only works for a number of characters between 1 and 60.
Generates a password using symbols, alpha, and digits. No repeating chars.