To check a password strength from the command line on GNU/linux systems, a library especially for this purpose is available in the distribution package manager. This library is called cracklib. cracklib is installed with few python scripts to make the usage of the library easy to use. Below a zsh TAB-completed cracklib- command to show the available scripts that are shipped with cracklib:

user % cracklib-

completing external command cracklib-check cracklib-format cracklib-packer cracklib-unpacker

This is a view installed on a gentoo system. The results on other GNU/linux distribtions may differ with the output above.

Verify the password strength using a one liner on your favourite shell:

user % cracklib-check<<< password password: it is based on a dictionary word

Notice the result of the cracklib-check informing about possible, and weak password usage.

In the case the password that needs to be verified has _ space in it, embed the password in quotation marks " or like shown in the example below in a apostrophe ':

user % cracklib-check<<<'Nur ein Beispiel für ein langes Passwort' Nur ein Beispiel für ein langes Passwort: OK

Notice the result of cracklib-script in the example above informing that the chosen password is OK.

The cracklib-check script allows also interactive usage mode. Using this mode each typed in phrase or password is validated:

user % cracklib-check

Network Network: it is based on a dictionary word CLI CLI: it is WAY too short IS-IS and BGP, is the way to go for me. IS-IS and BGP, is the way to go for me.: OK

Notice the various results based on the input. End this script by typing the CTRL C keyboard sequence in the terminal.

The last example for password strength check is sequence using the in-kernel cryptography. ranpwd is a random password generator using the in-kernel cryptography.

user % ranpwd|cracklib-check g0KK$n0r: OK

There are numerous other password generator tools available for your linux distribution, search for them in the distribution package manager. This example above is to show how to verify the password strength generated by only one of them. Swap the ranpwd with your favourite password generator of your liking.