pwgen Command

The pwgen command is a simple yet effective tool for generating secure, random, and pronounceable passwords from the command line. It is particularly useful for creating strong passwords that are still relatively easy for humans to remember and type.

Syntax

pwgen [OPTION]... [LENGTH] [NUM_PASSWORDS]

Description

pwgen generates passwords that are designed to be easily memorized by humans, while still being cryptographically strong. It achieves this by generating passwords that are pronounceable, avoiding sequences of characters that are difficult to type or remember.

Common uses include:

  • Generating strong, random passwords for various accounts.
  • Creating multiple passwords at once.
  • Generating passwords with specific characteristics (e.g., including numbers, symbols, or no vowels).

Common Options

Option Description
-c Include at least one capital letter.
-n Include at least one number.
-y Include at least one symbol.
-s Generate completely random, unpronounceable passwords.
-B Don't include ambiguous characters (e.g., 1, l, O, 0).
-v Exclude all vowels (to avoid accidental profanity).
-0 Don't include numbers.
-A Don't include capital letters.
-S Don't include symbols.
LENGTH Specify the length of the password (default is 8).
NUM_PASSWORDS Specify the number of passwords to generate (default is 1).

Examples

Generate a simple password

pwgen

Generates a single, 8-character, pronounceable password.

Generate a 16-character password with numbers and symbols

pwgen -cnys 16 1

Generates one 16-character password including capital letters, numbers, and symbols, and is unpronounceable.

Generate 5 passwords, 12 characters long, with no vowels

pwgen -v 12 5

Generates five 12-character passwords, excluding vowels.

Generate a password with no ambiguous characters

pwgen -B

Generates a password that avoids characters like '1', 'l', 'O', '0', etc.

Generate a password suitable for WEP keys

pwgen -A0 64

Generates a 64-character password consisting only of lowercase letters (no capitals or numbers), often suitable for WEP keys.

See also