This simple command prints out a long random number string from /dev/urandom.
jason@Yog-Sothoth » img » $ tr -dc "[:digit:]" < /dev/urandom | head -c 64 ; echo 9958048462925775253231939134565711861924198983498274782350446110
Do it this way to remove the newline after the output. This would be good for use in a script.
jason@Yog-Sothoth » img » $ tr -dc "[:digit:]" < /dev/urandom | head -c 96 598827488588935359227002896451901115916183070597575997276765531896915172047491309910275008172345
Print only upper case letters.
ason@Yog-Sothoth » img » $ tr -dc "[:upper:]" < /dev/urandom | head -c 96 ; echo WEZGBFWPHAWCWJYVPMBWKRXLHTILOPUEWLFBCBEWKDPFSIKXMYMSXSRVECWHWISAZWPHLBZIZDREBIRAUUFQIFSFGGLGVTXI
Print a long random string of graphical characters.
jason@Yog-Sothoth » img » $ tr -dc "[:graph:]" < /dev/urandom | head -c 96 ; echo X2,|Ut2A!V&>h}M9WMb/64&*.aya_O'^.%0x}'MKPK}0(KI8q7'qmc).\dd#!9cYJEal%uBfVkjI7I1.\j(e}R2ls|0DQFi"
Print only a random string of hexadecimal digits.
jason@Yog-Sothoth » img » $ tr -dc "[:xdigit:]" < /dev/urandom | head -c 96 ; echo 6d42253aF8Af0fbFc78c8aa20A33d2DC6AE6987D6593d053D4c9C494EeBb5cBc6ce3DafEFbbD92deAEaFaB2Ea07DAE9c
Include all upper and lowercase letters and numbers.
jason@Yog-Sothoth » img » $ tr -dc "[:alnum:]" < /dev/urandom | head -c 96 ; echo Y9bW54rVXjDkPecBKFKWSPsW0j0obUFMuqeR2ZI6Mz6NamgPtUHZmrPEoicK33BPcOjyRmesvrgA4mge4POgJnx7CdvCpre1
These simple one-liners can be used to generate random numbers and/or passwords. /dev/urandom is a very good source of random entropy. Not totally random, but good enough for most needs.
Here is another example, using shuf.
jason@Yog-Sothoth » img » $ shuf -i 1-4375674834837535 -n 1 4321886795046917