I know of two password generators in Debian. The first one which I have used is apg and it seems to generate some good passwords.

$ apg -m 15 -M SNCL

I also tried pwgen similarly

$ pwgen -1csy 15


$ pwgen -1sy 15

Now I have two questions instead of one, are there any shell/command-line based password generators known either in Debian or in the more wider GNU/Linux world (perhaps not packaged.)?

The other query is has there been any sort of comparisons made on the two password generators either on basis of their algorithm or the password-generating speed or something else entirely?

Looking forward to know.


Pwgen is a good choice but You can use the following command to generate the random password:

tr -dc A-Za-z0-9_ < /dev/urandom | head -c 16 | xargs

Sample outputs:


Also you can use the following shell function to generate random password.

Edit ~/.bashrc file, enter:

$ vi $HOME/.bashrc

Append the following code:

genpasswd() {
    local l=$1
        [ "$l" == "" ] && l=16
        tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs

Save and close the file.Source ~/.bashrc again, enter:

$ source ~/.bashrc

To generate random password, enter:

$ genpasswd

Sample outputs:


To generate 8 character long random password, enter:

$ genpasswd 8

Sample outputs:


Also you can use Aberystwyth University that has a pretty hardcore mnenomic-passsword generator.

example generated passwords :

ud5pwt.1    Ulrich's diabolic five praises Wendy's taciturn full stop lamely.
9y21%s@j    Nina's yellow zombie leads Percy's spurious at-sign joyfully.
lyw1osci    Lucy's yapping wolf lends one's smug creepy idea.
t4jhilh+    Tudor's fourth jumper hectors Isabel's listless haggard plus sign.
ngi.o1v_    Nia's garish ice stops Olga's first vengeful underscore.
rfint5*d    Ruth's flabby ice names Tracy's fifth star daily.
d&st,vvd    Douglas's handy salamander transforms Conner's vague villainous daffodil.
xe;2bba4    Xenia's enchanting semicolon zooms Bart's burly arcane four.
5p<kxhnf    Fife's pensive less than sign knits Xenia's hapless notorious fang.

Interesting work. You might like to email their sysops to see if the script behind it is freely available (and if it's not, whether they'd consider GPLing it)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.