Category Archives: fun

Bash for the word lover

It’s a WYSIWYG world. After all, we’re nearly in the future, which I define as 2019, the year Rick Deckard chases down replicants in the Blade Runner. Still no flying cars, which is disappointing. Even so, we have Steve Jobs, so the future coming, right?

GUI everything isn’t all that it could be. For many, many tasks, it is more expeditious to open a terminal and get a bash prompt. CLI. Character. Text. It could be green on black, or it would be a rainbow on white, but it is not different from a Televideo terminal, or a Teletype for that matter. As good as the Bourne Again Shell is, it is not graphical or fancy.

What it is is efficient. For a sharp mind and one given to efficiency, the terminal is power. Want to replace frick with frack in 800 HTML files?

find ~/web/project3 -name '*.php' | xargs perl -pi -e 's/frick/frack/g'

Bam. Done.

This is why I have 3 terminals open right now. One is connected to a server somewhere in Texas. I just fixed some text on a site with a command much like the one above.

But you already knew all that. You Googled and found this page, so you are already 1337 or whatnot. How about some word power on the command line?

Install some packages

This will install the packages we will use on an Ubuntu or Debian system. For other distributions, you will need to use your distributions package system.

To install on Ubuntu or Debian, just install the needed APT packages:

sudo aptitude -y install wordnet wamerican-large curl wget an


This grabs a definition for a word from For “unusual” for example:

curl --stderr /dev/null dict:// | sed '/^[.,0-9].*$/d'

Which returns:

Unusual \Un*u"su*al\, a.
Not usual; uncommon; rare; as, an unusual season; a person of
unusual grace or erudition. -- {Un*u"su*al*ly}, adv. --
{Un*u"su*al*ness}, n.
[1913 Webster]

As you can see you are using curl to request a definition for “unusual”, then using sed to filter the results, to exclude extra stuff you don’t want. You could just enter “curl dict://” for the raw deal. Good on ya.

You can turn this into a script:

#! /bin/bash
# display definition of a word
curl --stderr /dev/null dict://$1 | sed '/^[.,0-9].*$/d'

Save that in a file called “def” and run “chmod +x def” to make it executable. Then “def unusual” will return the same definition. You just created your own tool. You rock.


How about more power? Princeton has a project called Wordnet, which organizes nouns, verbs, adjectives and adverbs into set of “cognitive synonyms” and provides tools to use this data. With Wordnet, synonyms, antonyms and other lexical relations can be found for a given word.

To show a definition, (still using “unusual” as an example):

wn unusual -over

Here’s the output:

Overview of adj unusual

The adj unusual has 3 senses (first 3 from tagged texts)

1. (24) unusual -- (not usual or common or ordinary; "a scene of unusual beauty"; "a man of unusual ability"; "cruel and unusual punishment"; "an unusual meteorite")
2. (1) strange, unusual -- (being definitely out of the ordinary and unexpected; slightly odd or even a bit weird; "a strange exaltation that was indefinable"; "a strange fantastical mind"; "what a strange sense of humor she has")
3. (1) unusual -- (not commonly encountered; "two-career families are no longer unusual")

This uses the “-over” option. Some other options are:

-synsa adjective synonyms
-synsn noun synonyms
-synsr adverb synonyms
-antsa adjective antonymns
-antsn noun antonymns
-antsr adverb antonymns

Wordnet is extensive and there are many more options, run “man wn” for more.

Crossword help

This is simply a use of grep to pattern match words in a word list file.

Use a regular expression to find a word. In quotes, start your pattern with a “^” character and end with a “$” character. Use a period “.” for each unknown character.

grep '^.a...f.c.n...$' /usr/share/dict/words



This uses the rhyme project, which provides a rhyming dictionary for the command line.

To get, build and install rhyme on your system:

sudo aptitude -y install build-essential libgdbm-dev libreadline-dev
cd ~
DIR="src" && [ -d "$DIR" ] || mkdir "$DIR"
cd src
tar -xzf rhyme-0.9.tar.gz
cd rhyme-0.9
sudo make install

Holy smokes, you just built software! There is no stopping you. To find a rhyme, using “house” as an example:

rhyme house

House rhymes! Lots of them.


Anagrams are pretty much pure word fun. It is fun to see what an anagram of your name is.

Print single-word anagrams of “andrew”:

an -l 1 andrew

Just call me the wander warden.

Emulating a Z80 and CP/M on Ubuntu Linux

Here is how to emulate a Z-80 processor running CP/M on Ubuntu Linux.

This method is very easy and achieves an excellent, easy to use and understand system. Essentially, the trick is to use a DOS-based emulator that works really well in a DOS emulator under Linux. I haven’t found a good Z80 emulator that runs directory under Linux.

To begin though, a mystery must be told. There, apparently was a fellow named Simon Cran in Australia who wrote a lovely CP/M Z-80 emulator for DOS. If you Google his name and “CPM” you can delve into the mysterious Simon Cran who created MyZ80 as shareware in the early nineties and then, seemingly vanished into ‘net anonymity.

I found that MyZ80 works well run in the dosemu DOS Emulator on Linux. I used to use this setup when I used Suse and it also works well on Ubuntu.

Install DOS Emulator

Install DOS Emulator:

sudo aptitude install dosemu

On my system dosemu has the equivalent of a DOS C: drive inside ~/.dosemu/drive_c/.

I have DOS in a Box installed as well as dosemu. When I run dosemu, it opens this window…seems to work fine.

Install MyZ80

Download MyZ80 from and unzip it into ~/.dosemu/drive_c/myz80/ – as illustrated, above. An easy way to do this is to plop the ZIP into ~/.dosemu/drive_c/ and then right-click and select Extract here.

Run MyZ80

In a Terminal, run:


Then run MyZ80:

cd myz80

You will be greeted with this friendly text:

A couple of return key presses will then show how to import and export data into the files that Simon Cran uses for the CP/M drives:

The command to exit MyZ80 is exit. The command to exit dosemu is exitemu.

I have run Wordstar and Turbo Pascal using MyZ80, re-living my experience with my Kaypro 10…a machine I miss very much!

Some useful links

Have fun!