shuf: Random yet intelligible

I am pretty sure this little gimmick comes by way of reddit’s commandline subreddit; I could swear I have seen this before, in some shape or another.

Either way, a tip of the hat to ladygrey2, who mentioned that the stunt with tr and /dev/urandom a few weeks ago was nice, but lacked a measure of legibility.

In the case that someone might want to assign an actual word to a file, shuf (probably in your system as part of coreutils) and whatever dictionaries you have on hand might be better.

shuf -n 1 /usr/share/dict/cracklib-small

On my very sparse Arch system, that spits out a random English word every time, with things like frivolous, yeager and enthusiastically popping up.

So, to splice this into the aforementioned tr suggestions:

mv testfile.txt `shuf -n 1 /usr/share/dict/cracklib-small`.txt

And suddenly testfile.txt becomes junta.txt. Or something like that. 😉