How do I play a midi from the command line in Ubuntu?

There are many different packages/commands you can try:

  1. wildmidi (as used by gstreamer)
  2. timidity (found this very CPU intensive)
  3. playmidi (never tried personally)

You'll likely want the playmidi package (sudo apt-get install playmidi) which will allow you to play midi files from the command line.

playmidi filename.mid


fluidsynth from http://www.fluidsynth.org/.

Use it like this:
fluidsynth /some/dir/with/sundfonts/some_soundfont.sf2 some.mid

You can find soundfonts here: https://musescore.org/de/handbuch/soundfont

And quite a nice collection of MIDI files to try this out here: http://garyrog.50megs.com/midi1.html

I especially like the soundfont "Timbres of Heaven" from http://midkar.com/soundfonts/.