Master and Commander (1971) is a novel by Patrick O'Brian, the first in the Aubrey–Maturin series.
The 2003 film , starring Russell Crowe, is very freely based on this and other books in the Aubrey–Maturin series.
Master and Commander begins on April 18th, 1800 in Port Mahon, Minorca, at the time a base of the Royal Navy. Jack Aubrey is a Lieutenant languishing in port without a ship, Stephen Maturin a penniless half-Irish, half-Catalan physician and natural philosopher. The two main characters are first set at odds by and then united by a love of music (Aubrey plays the violin, Maturin the cello).
The novel introduces these two characters and gives Jack his first command (and promotion to the rank of Commander) on a tiny sloop-of-war, HMS Sophie. Stephen accepts a position as Sophies surgeon. We also meet Pullings and Mowett, who become permanent fixtures in the series, and James Dillon, Sophies first lieutenant, whose secret background of Irish Republicanism intersects Stephen's own.
The capture of the Spanish xebec-frigate Cacafuego by the greatly inferior Sophie brings Aubrey and his crew great glory and wealth and is based on the capture of the Spanish frigate El Gamo by Thomas Cochrane commanding the sloop Speedy [1].