Skip to content

Instantly share code, notes, and snippets.

@emil10001
Created September 13, 2015 06:46
Show Gist options
  • Save emil10001/ddd49a824244bd4886b8 to your computer and use it in GitHub Desktop.
Save emil10001/ddd49a824244bd4886b8 to your computer and use it in GitHub Desktop.
Simple bash function for generating a random password
#!/bin/bash
function pw () {
cat /dev/urandom | env LC_CTYPE=C tr -dc a-zA-Z0-9 | head -c $1; echo;
}
@emil10001
Copy link
Author

Run as follows:

$ pw 4
96uB
$ pw 40
QNugNLDHpCL2LMS6aaxagTpInUQEWgWjagEo1Iv0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment