I needed a way to generate random strings to be used for an API Key.
There are online password/hash generators however as they are online I’m hesitant to use them as they can store generated strings. Not great when you want to be as secure as possible to prevent data breaches on your web server.
Install pwgen
The following install is for Ubuntu using the APT package manager, this application should be installable in most Linux distributions package managers.
sudo apt install pwgenUsage
Running the pwgen will generate a collection of 160 passwords with each being eight characters long.
pwgenTo output a single password add the -1 flag.
pwgen -1To change the character length for each password use the -y flag followed by the character count.
pwgen -1 -y 30To include at least one capitalized letter use the -c flag.
pwgen -1 -y 30 -c