The pwgen is a tool that enables to generate random passwords via command line. This tool is designed for generating secure passwords which can be easily memorized by humans.
This tutorial shows how to install pwgen on Ubuntu 20.04.
Execute the following command to update the package lists:
sudo apt update
sudo apt install -y pwgen
pwgen command without any arguments:
By default, pwgen generates 160 passwords which are 8 characters in length.
eghaeW1c Hai0Ahy9 riz5weGh Fohj4Ogi aiz9Diol Huphoh7f Taez2Bei xau9Phoo vee6Eing eicieN2i Xi1pheeV Epa9puce ciaqu5Pe zighai5Z Aegha2ah LiPhee8p ........... Jes1quae ieShah9u zeeG3Pah aicil9Yi Goo1eiqu ah7mohPh Aqueene4 Ahqu4iep
You can provide the password length as first argument:
ui5uuzoh2Iet hooBuo2gooW4 aax9Phei2ush oochao0xaiP2 kae6Zeengait unozi9iuPh2i ...........
The number of passwords to generate can be provided as second argument:
pwgen 8 1
Only one password will be generated with length of 8 characters:
By default, pwgen includes at least one number and one capital letter in the password. Additional options can be used to generate password without numbers or capital letters:
pwgen 8 1 --no-numerals --no-capitalize
By default, special characters not included in the password. The
--symbols option allows to include at least one special character.
pwgen 8 1 --symbols
If you decided to completely remove pwgen, execute the following command:
sudo apt purge --autoremove -y pwgen