Small script to generate a random password. Works on Linux with busybox, haven't tested on GNU.

hexdump -e '"%02x""\n"' /dev/random | tr -d '\n' | dd count=32 bs=1 2>/dev/null; echo

@yyp > /dev/random
I thought /dev/urandom was preferable to /dev/random?

@Phate6660 /dev/urandom is a pseudo-random number generator, /dev/random is a more true generator that uses various random information from the kernel like input events or hardware temperature from what I remember


</dev/urandom tr -dc '[:alnum:]' | head -c 32 ; echo

And a stronger version,

</dev/urandom tr -dc '[:alnum:][:punct:]' | head -c $(( $RANDOM % 32 + 32 )) ; echo

For completeness' sake, here's a pretty picture [command line password generator (for the search engines)].

And I definitely recommend pass(1).

@torresjrjr I've been using pass until recently. It strictly depends on coreutils, and I'm on Alpine Linux, which kind of defeats the point of Alpine. And there's not that much to gain for me when using pass anyway, since it's just GPG encrypted files and I already know how to manage such :)

Sign in to participate in the conversation

Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.