Here is a quick way to generate a random alphanumeric string in the shell:

    LC_CTYPE=C tr -dc '[:alnum:]' < /dev/urandom | head -c 20; echo

Here is an example output:

    GrWPmvF1oOmbeUzyJwC3

The command works both on macOS as well as Linux. The `LC_CTYPE=C` environment variable is set specifically to make the command work successfully on macOS. Without it `tr` may report an "Illegal byte sequence" error.