Create passwords that meet specific criteria on the command line.
![Password lock][1]
Most websites and applications ask users to create accounts with secure passwords so that they can provide tailored user experiences. While this tips the odds in favor of website developers, it certainly doesn't make life easier for users.
Sometimes the rules for creating passwords are so strict that it's hard to get a good and allowable combination. It would be much easier to have a tool that generates secure passwords that meet whatever rules the website or application requires.
This is where pwgen comes into play. According to its [man page][2], "the pwgen program generates passwords which are designed to be easily memorized by humans, while being as secure as possible." It returns multiple password options that meet the criteria you provide so that you can select the one that you prefer (and might be more likely to remember).
### Install pwgen
On Linux, you can install pwgen using your package manager. For instance, on Fedora:
```
`$ sudo dnf install pwgen`
```
On macOS, use [MacPorts][3] or [Homebrew][4]. On Windows, use [Chocolatey][5].
### Generate passwords with pwgen
There are several ways to pass arguments to pwgen to generate passwords, depending on what parameters you need. Here are some examples; consult the man page for more options.
If you need a secure, hard-to-remember password of a specific length, run `pwgen --secure` (or `-s` for short) followed by the character length you need:
Good, randomized passwords are hard to invent, especially because the human brain tends to prefer patterns. Make password generation easier on yourself by using pwgen. With a good [open source password manager][6], you can benefit from passwords that are hard to guess but easy to use from start to finish.