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.
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:
Generate a truly random password using noise from your microphone to seed the RNG. This will spit out 12 password with 12 characters each, but you can save this into a bash script and replace 'pwgen -ys 12 12' with 'pwgen $@' so you can pass any paramters to pwgen as you would normally do.
I know there are a lot of random password generators out there, but I wanted something that put out something besides hex. Set count equal to the number of bytes you want.
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
Use less random number resources and less commands
Uses urandom and tr to generate a random password. Change the value of head -c## for the lenght of the password.
Dumps 20 bytes from /dev/urandom and converts them to hex. -c and -p are needed to prevent splitting over lines.
This snippet will produce an alpha-numeric 16 character password
for i rang(10) = length of the password
random.choice("abcdefghijklmnopqrstuvwxyz...") = char allowed into the password
Thanks Python/Django FAQ's.
A slightly shorter version. Also doesn't put a return character at the end of the password
A more robust password creation utility
# Create passwords in batch
makepasswd --char=32 --count=10
# To learn more about the options you can use
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.
Permit to generate a password for userPassword in ldap.
Use ?slappasswd -g? to generate a random passowrd.
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:]
apg generates several random passwords. It uses several password generation algorithms (currently two) and a built-in pseudo random number generator.
Replace < pw-length > with the desired password-length.
The password-length is not always correct, but wayne...
no need that useless cat.