Search

Dark theme | Light theme

July 15, 2026

Nushell Niceties: Generating Passwords

Since Nushell 0.114.0 you can use the random pass command to generate a random password of 12 characters. Nushell will use a combination of letters, numbers and symbols. It is possible to generate a password with a different length using the command-line option --chars (or -c) followed by the size of the password. The minimal length is 4 characters and the maximum size is 128 characters.

If you don’t want to include symbols then you must use the option --no-symbols (or -s). To exclude numbers the option --no-numbers or short-hand -n must be used. And finally to exclude lowercase characters use --no-lowercase (or -l) and to exclude uppercase characters use --no-uppercase (or -u).

To support a requirement that at least one character, one number and one symbol is needed the option --require-each-type must be used. By default Nushell will not use the ambiguous characters 0, O, 1 and l in the same password, because it can be hard to read the differences between the characters with some fonts. In order to use these characters in the same generated password you must the option --include-ambiguous. Also the characters i, 1 and l are not used together, but if you specify the option --include-similar these characters can be used in the same generated password.

In the following example several options are used:

> random pass
-XYPe;W63fKo

> random pass --chars 16
2i[`+F-2vV0U_7Rc

> random pass --chars 20 --no-symbols
za2V3aNPXpvhwRUINZPV

Written with Nushell 0.114.1