Bash - Generate Random Strings For Passwords

Comments

Here is a simple script to create random strings in Bash, handy for things like passwords.

# Just alphanumeric characters
charSet="[:alnum:]"
# Alphanumeric + special characters
charSet="[:graph:]"
pwdSize=20
cat /dev/urandom | tr -cd "$charSet" | head -c $pwdSize

Examples

Alphanumeric: RIjWZarp6DbHqdzLU09an
Special characters: R;V_\~|1d\[email protected]\~P$F]w#n

Next Post
Python - Generate Random Password Strings

Previous Post
Migrate Emails Between Servers


comments powered by Disqus