Back to technology news
Software & Applications

Hacking Wordle: A New User's Guide to the Power of the Linux Terminal

For new Linux users the terminal can feel like the Sphinx, quiet and mysterious, offering no help to those who do not already speak its language. This guide demonstrates how to get comfortable with the terminal by using common commands to analyze a text file of words used by the popular online game Wordle. The analysis provides real tasks that give hands-on experience with the Linux command line, skills that apply to working with logs, configuration files, and searching text inside files, while also allowing users to explore Wordle word patterns. The guide assumes a standard desktop install and walks the reader through setting up a workspace to begin analysis.

The guide begins by explaining what Wordle is: an addictive word game hosted by the New York Times where the goal is to guess a five-letter word in no more than six guesses. Wordle uses a curated list of words, narrowing the pool from about 20,000 dictionary five-letter words to approximately 2,500 curated words. Offensive words, words with special characters or spaces, non-American spellings, and names are excluded from the list. The guide cautions that while being clever about games is fun, using these tools to cheat against others is not appropriate.

New users are introduced to the terminal through a quick tour of the application that provides access to the command line. On Fedora Workstation the terminal emulator is called Terminal, while Fedora KDE uses Konsole. The prompt displays the username, hostname, current working directory using the tilde for the home directory, and a dollar sign indicating non-root permissions. The guide confirms that the default shell for almost all Linux distributions is bash and explains how to verify the shell by typing echo $SHELL.

Users create a workspace by changing to the Documents directory and making a new folder called wordle. After confirming the directory with pwd, they download a Wordle word list using the wget command. The file shuffled_real_wordles.txt contains 2,315 words, close to the number of curated Wordle words. The guide explains how to view the file with less, count lines and words with wc, and edit the file using nano to remove the descriptive first line, leaving exactly 2,315 lines of five-letter words.

The analysis section introduces questions about letter frequency, most frequent starting and ending letters, and letter pairs or digraphs. The guide demonstrates the grep command for finding patterns in the word list, showing how to search for specific words, use wildcards like the dot to represent any single character, and use anchors to search at the start or end of lines. Examples include finding words starting with eat or ending with eat, and using grep -c to count matches and grep -o to output every occurrence of a pattern.

The guide explains how to use pipes and filter commands to count letter frequencies across the entire word list. By piping grep output through sort and uniq -c, then sorting numerically in reverse order with sort -nr and formatting with column, users can see letters ranked by frequency. The example shows e as the most frequent letter with 1,233 occurrences, followed by a with 979, and other letters descending in frequency. The guide concludes that these fundamental text analysis skills provide a practical introduction to the power of the Linux terminal.

Source credits

By Thomas Cummings from Fedora Magazine. Edited by SetuGeo.

CC BY-SA 4.0

More technology news

Browse all technology news