Password generation one-liners
Sometimes you need to generate a password using only commonly available tools. These commands generate passwords given a required strength in bits. For comparison, an 8-character alphanumeric password has a strength of log₂ 36⁸ ≈ 41 bits.
Generate an 12 × 8 = 96 bit password with the Base32 alphabet (using coreutils' base32 command):
head -c 12 /dev/random | base32 | tr A-Z a-z | tr -d = | fold -w 4 | paste -s
Generate an 16 × 8 = 128 bit password with the Base64 alphabet (using python:
head -c 16 /dev/random | python -m base64 | tr -d =
Generate a 32 × 8 = 256 bit passphrase using the Electrum wordlist:
python lib/old_mnemonic.py "$(od -v -A n -t x1 -N 32 < /dev/random | tr -d ' \n')"
On the web
Diceware secure passphrase generator
Entropy level recommendations
See Lenstra Updated Equations. This reckons 96 bits protects you until 2040, 112 bits until 2066 and 128 bits until 2090.
The Diceware Passphrase FAQ says 6 use at least 6 words for a password manager application (i.e., offline attacks). But that's only 6 * log2(7776) = ~77 bits...