|This article does not cite any references or sources. (May 2007)|
The commanding officer (CO) is the officer in command of a military unit. Typically, the commanding officer has ultimate authority over the unit, and is usually given wide latitude to run the unit as he sees fit, within the bounds of military law. In this respect, commanding officers have significant responsibilities (for example, the use of force, finances, equipment, the Geneva Conventions), duties (to higher authority, mission effectiveness, duty of care to personnel) and powers (for example, discipline and punishment of personnel within certain limits of military law).
In some countries, commanding officers may be of any commissioned rank; usually there are more officers than command positions available, and time spent in command is generally a key aspect of promotion, so the role of commanding officer is highly valued, and in theory only goes to the best officers. The commanding officer is often assisted by an executive officer (XO) or second-in-command (2i/c), who handles personnel and day-to-day matters and a senior enlisted advisor. Larger units may also have staff officers of various responsibilities.
United Kingdom, Canada and Australia 
In the British Army, Royal Marines, and many other Commonwealth military and paramilitary organisations, the commanding officer of a unit is appointed. Thus the office of CO is an appointment. The appointment Commanding Officer is reserved for commanders of major units (regiments, battalions and similar sized units), it is customary for a unit CO to hold the rank of Lieutenant Colonel and usually is referred to within the unit simply as "the Colonel". However the rank of the appointment holder and the holder's appointment are separate. I.e. all Lieutenant Colonel's are not CO's and although most COs are Lieutenant Colonels, that is not a requirement of the appointment.
Sub-units, i.e., company, squadron and battery, do not have a commanding officer appointed. The officer in command of a sub unit holds the appointment "Officer Commanding" or "OC". The OC of a sub-unit is customarily a Major, though again the rank of the appointment holder and the holder's appointment are separate and independent of each other.
In some cases independent units smaller than a sub-unit, e.g. a platoon, such as a platoon of MPs that reports directly to a formation such as a brigade will also have an OC appointed. In these cases the OC will often be a captain or even a lieutenant. i.e. where it's reporting relationship is the same as that of a unit or sub-units then a platoon or smaller unit might have an OC appointed.
Appointments such as CO and OC may have specific powers associated with them, sometimes by law. E.g. they may have statutory powers to promote soldiers or to hold/try certain disciplinary positions and award certain punishments. For example the CO of a unit may have the power to sentence an offender to 28 days detention, whereas the OC of a sub-unit may have the power to sentence an offender to 3 days restriction of privileges.
Units smaller than sub-units, i.e. platoons, troops and sections are not specific appointments and officers or NCOs who fill those positions are simply referred to as the commanders/leader. e.g. Platoon Commander, Troop Leader, Section Commander/Leader, etc.
Air Force 
In the Royal Air Force, the title of Commanding Officer is reserved for Station Commanders or commanders of independent units. As with the British Army, the post of a commander of a lesser unit such as an administrative wing, squadron or flight is referred to as the Officer Commanding (OC).
In the Royal Navy, Commanding Officer is the official title of the commander of any ship, unit or installation. However, they are referred to as "the Captain" no matter what their actual rank, or informally as "Skipper" or even "Boss".
United States 
In the United States, the status of commanding officer is duly applied to all commissioned officers who hold lawful command over a military unit, ship, or installation.
The commanding officer of a company, usually a captain, is referred to as the company commander (or the battery/troop commander for artillery/cavalry). The commanding officer of a battalion (or squadron of cavalry), usually a lieutenant colonel, is the battalion commander. The commanding officer of a brigade, a colonel, is the brigade commander. At the division level and higher, however, the commanding officer is referred to as the commanding general, as these officers hold general officer rank.
Although holding command in the same sense as others officers, the individual in charge of a platoon, the smallest unit of soldiers led by a commissioned officer, typically a second lieutenant, is referred to as the platoon leader, not the platoon commander. This officer does have command of the soldiers under him but does not have many of the command responsibilities inherent to higher echelons. For example, a platoon leader cannot issue non-judicial punishment.
Warrant officers in the United States armed forces are single career-track officers that can, and occasionally do, hold command positions within certain specialty units, i.e. Special Forces and Army Aviation. However, warrant officers usually do not command if a commissioned officer is present; normally they serve as executive officer (2IC).
Air Force 
In the United States Navy, commanding officer is the official title of the commander of a ship, but they are usually referred to as "the Captain" regardless of their actual rank, or informally referred to as "Skipper".