divecmd is a suite of open source command-line UNIX tools to extract and
manipulate dives from dive computers.
Why use it instead of, say, Subsurface?
Because it's built to work in a command-line workflow with other command-line tools for processing, such as
grap(1) piped into groff(1) or LaTeX.
My workflow usually begins with dcmd(1) on the day of my dive.
First, I extract the dives from my Suunto D6i into an XML file for the day.
dcmd(1) keeps track of my last extracted dive, so it will only extract new dives
(presumably from the current day):
These graphs let me see my dive depths and times, and also see whether I'm following the surface-time rule of
thumb, where rest is twice the prior dive.
Note: if you're free diving and using a dive computer that lumps all free dives into one huge
dive without splitting them up by surface time, use dcmdfind(1) to
canonicalise the dives. My HW OSTC 2C does this.
Or I'll take a sneak peak only at the day's dives on my terminal:
To use divecmd, you'll need a reasonably up-to-date UNIX system (OpenBSD, Linux, Mac
You'll also need the excellent libdivecomputer, which does
the heavy lifting to interface with your device.
Just run ./configure, sudo make install (or doas).
The dcmd2grap(1) utility converts from XML into the grap(1) format.
Aside: why grap(1)? Because
it fits into the standard piped UNIX workflow.
I can send the output directly into groff(1) without needing
to manage the intermediary files of gnuplot or LaTeX.
I use these other tools all of the time, but prefer to avoid them for that reason.
See also dcmd2pdf(1), which manages the groff pipeline.
The divecmd suite also has
dcmdterm(1), which formats graphs on a UNIX terminal.
This is useful for a quick peek at one's dives.
It was the first output mode I wrote, just to test that dcmd(1) was exporting
dcmdterm(1) doesn't have as many fancy modes as
dcmd2grap(1), but it's still a quick and easy way to see one's dives.
Especially when setting up a groff(1) pipeline takes too many
The arguably most-used output mode is also the simplest: dcmd2json(1),
which converts graphs to JSON. I use it constantly for divelog.blue,
specifically to show the dive profiles. Technically, I could
simply bundle the native dcmd(1) output directly and use an XML-to-JSON
formatter in the client, but this is easier.
As much as I use dcmd2grap(1) and friends for my needs, others prefer using
tools like Subsurface To do so, one needs to be able to export into
a format used by Subsurface. The divecmd suite has dcmd2csv(1), which exports a (for the time being minimal) set of
information in CSV format. This can then be imported into Subsurface using the import utility.
If you have lots of dive files and want to consolidate, you can use the
dcmdfind(1) utility, which is able to pull together a lot of files,
de-duplicate entries, and print them out again.
Some dive computers, like the HW OSTC 2c, put all free dives into a single dive sequence.
The dcmdedit(1) lets you split those apart for analysis.
(You can also merge them back together with the same tool.)
The helpful dcmdls(1) tool accepts a set of files, groups them by dive
computer and diver, and lists their contents.
This makes browsing through a lot of dives much easier!