Commanding officer, also known as a C.O. is an officer who has command responsibility for a post - such as an installation, station, or a ship in both the United Earth Starfleet as well as the Federation Starfleet.
For most starship commands, a commanding officer will usually hold the rank of Captain, however this is not always the case. Individuals from the rank of Lieutenant all the way up to Admiral have been known to hold the post of commanding officer.
In 2364 the Bluegill parasites attempted a takeover of Starfleet, which was detected by a number of Starfleet officers. Learning of this possible conspiracy, Captain Jean-Luc Picard had Lt. Commander Data review all Starfleet orders for the past six months. In the course of his review, Data learned that there was among other things an uncustomary shuffling of commanding officers, with these new C.O.'s having frequent contact with the highest levels of Starfleet Command