•
(edited )
Assume we have a plain text file with one word per line. On Linux systems such a file usually exists at /usr/share/dict/words. If you don't have such a file, you can write one yourself or download the 8k wordlist (diceware.readthedocs.io) and rename it to words.
mv -iv diceware8k.txt words
NOTE: Be sure that the file contains only one word per line!
Now for the tricks. I'll use the file /usr/share/dict/words, but you may replace that with the path to your words file.
Print two random words
$ shuf -n 2 /usr/share/dict/words
Watsonville's
clapboarding
Print words which contain only letters without punctuation
$ grep -E '^[[:alpha:]]+$' /usr/share/dict/words | shuf -n 2
Brazos
flagellating
Print words which only contain lowercase letters
$ grep -E '^[a-z]+$' /usr/share/dict/words | shuf -n 2
recapitulate
groveler
Print words on a single line separated by a single space
$ echo $( grep -E '^[a-z]+$' /usr/share/dict/words | shuf -n 2 )
lash deicers
Assume we have a plain text file with one word per line. On Linux systems such a file usually exists at `/usr/share/dict/words`. If you don't have such a file, you can write one yourself or download the *[8k wordlist](https://diceware.readthedocs.io/en/stable/wordlists.html)* and rename it to `words`.
mv -iv diceware8k.txt words
**NOTE:** Be sure that the file contains only one word per line!
Now for the tricks. I'll use the file `/usr/share/dict/words`, but you may replace that with the path to your `words` file.
# Print two random words
$ shuf -n 2 /usr/share/dict/words
Watsonville's
clapboarding
# Print words which contain only letters without punctuation
$ grep -E '^[[:alpha:]]+$' /usr/share/dict/words | shuf -n 2
Brazos
flagellating
# Print words which only contain lowercase letters
$ grep -E '^[a-z]+$' /usr/share/dict/words | shuf -n 2
recapitulate
groveler
# Print words on a single line separated by a single space
$ echo $( grep -E '^[a-z]+$' /usr/share/dict/words | shuf -n 2 )
lash deicers
(post is archived)