fortune prints a random quotation from a database of quotes, sayings, and jokes, a tradition going back to Version 7 Unix.
sudo dnf install fortune-mod cowsay # or apt-get install fortune-mod cowsay
fortune
fortune | cowsay # a cow says your fortune
fortune -s # short fortunes only
Add your own fortune file¶
sudo mkdir -p /usr/share/games/fortunes # path varies by distro
sudo tee /usr/share/games/fortunes/custom << 'EOF'
seditious [adjective]
conduct or speech inciting rebellion against the authority of a state.
%
collywobbles [noun]
butterflies in one's stomach.
%
EOF
sudo strfile /usr/share/games/fortunes/custom # builds custom.dat; required, or fortune reports the file as invalid
fortune custom
Each entry ends with a line containing only %. Skipping strfile produces "not a fortune file or directory" when you try to use it. Combine with espeak for a spoken fortune, or add fortune | cowsay to a shell's login greeting for fun.