The linux tr command can be used to substitute certain given letters, or delete them or do substitution and deletion on the given letters compliment. Meaning if I say delete all k’s, it will delete all k’s, but If I say delete all the compliments of k, then it will keep all of the k’s, and give you nothing back, besides k’s back. The -d parameter in tr deletes (the other alternative besides deleting is substitution to another character), and -c points at the compliments. So if i pump in random binarys of 1 and 0 into tr (random 1s and 0s: thats what /dev/random and /dev/urandom generate random 1s and 0s based on environmental settings, or how ever your system is designed to do its random generation – every 8 bits of 1s or 0s that come in generate a byte of 1 of 255 possibilities, 26 of those possibilities are lower letters and 26 other possibilities for upper letters, so 26+26=52 possible bit combinations out of 255 to make human readable lower or upper case letters), then if I tell tr to delete the compliment of a-z thats the same thing as saying keep a-z (and it will keep them at the random order in which they come in), finally I tell it to stop doing everything after it reached 8 bytes worth output (head -c 8, the -c tells head to take in a certain amount of bytes and stop, usually head operates on lines but with -c it operates on characters aka bytes)
How to make it out of all letters (8 letters long):
echo $(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c 8)
You could also use /dev/random:
echo $(< /dev/random tr -dc _A-Z-a-z-0-9 | head -c 8)
How to generate a password out of all printable characters
echo $(< /dev/urandom tr -dc “[[:print:]]”| head -c 8)
How to make a password out of certain letters
echo $(< /dev/urandom tr -dc infotinks| head -c10)
Note: Even thought I wrote infotinks, it will still only generate a password out of k,o,s,b. It will not favor the S’s and O’s because of their frequency.
How to generate stream of 1,0s (its not fast so I wouldnt rely on this for an actual stream of ones an zeros):
echo $(< /dev/urandom tr -dc infotinks| head -c10)