Warning shot

A warning shot is a military and/or police term describing an intentionally harmless artillery shot or gunshot with intent to enact direct compliance and order to a hostile perpetrator or enemy force. It is recognized as signalling intended confrontations on land, sea, and air.

As an analogy, "warning shot" can be said of any action of declaration, especially a demonstration of power, intended or perceived as a last warning before hostile measures.

Nautical
During the 18th Century, a warning shot (in nautical terms, often called a shot across the bow) could be fired towards any ship whose "colours" (nationality) had to be ascertained. According to the law of the sea, a ship thus hailed had to fly her flag and confirm it with a gunshot. Warning shots may still be used in modern times to signal a vessel to stop or keep off and may be fired from other ships, boats, or aircraft.

Aviation
Warning shots are also used in military aviation, to demand some action of an "enemy" aircraft; the most common demand would be for the aircraft to change course. The ostensible justification for firing shots is that tracer rounds are very bright and would immediately gain the attention of a crew whose radio is non-functioning, or who might not have noticed radio transmissions. The objective of warning shots is to demonstrate the ability to shoot, and threaten the enemy that they will be shot down if they do not comply.

Threat to shoot
On the ground, a warning shot from a pistol, revolver, rifle, or shotgun is fired into the air or a nearby object, or aimed so that the shot harmlessly passes by the one being warned. This is a sufficiently aggressive act to demand attention and alert onlookers that they might be shot if directions are not followed.