From Destinypedia, the Destiny wiki
This article is about the Ghosts created by the Traveler. For The Guardian's Ghost, see Ghost (Little Light).
Ghosts are small, sapient machines created by the Traveler shortly after the Collapse. Their sole purpose is to locate and resurrect deceased individuals capable of wielding the Light as Guardians, and to support their Guardian charge in combat.
After the Collapse, the wounded Traveler deliberately shed many pieces of itself. These pieces understood intuitively that they had a mission to raise a companion from the dead, their Chosen, and created mechanical shells for themselves. Every Ghost that exists was created in that moment; they are otherwise irreplaceable. Despite their origin as pieces of the Traveler, Ghosts do not possess any special insight into the nature of the Traveler, or into other matters pertaining to the Light and Darkness.
Every Ghost has a unique personality and identity, though not necessarily a name. This personality may be intended to complement that of the Chosen they're meant to eventually revive,  and often they have a name coined by their Chosen, whilst others may take names they are given by others.
When a Ghost revives their Chosen, they are bonded together from that point forward. A "neural symbiosis" begins between them. Every Ghost has one specific person they are meant to revive. For some, their Chosen is a sort of "soul mate" and they know instinctively when the right remains have been found;  for others, they simply search until they find someone they feel is worthy of the Light or has a "spark". Many Ghosts have spent the time since the Collapse searching fruitlessly for their Chosen. In the worst case, their Chosen's corpse may be irretrievably destroyed before they could be revived, leaving the Ghost's quest eternally unfinished. 
Some Ghosts lose hope in ever finding their Chosen; these usually find some other way to make themselves useful, such as joining the Vanguard's covert Spectral Network, where they act as scouts and spies for the Vanguard. Ghosts that never find their Chosen may be referred to as "unconnected" or "unpartnered".
On revival, the Ghost's Chosen becomes a Light-bearing Guardian. Once a Ghost chooses, they can revive no one else. It is possible for a Ghost to bond to someone other than their original Chosen, as with Shin Malphur, though that case required special circumstances.
Destiny 2 reveals that Ghosts enter a temporary catatonic state when the Light is cut off from them. Much like their Guardians, the Lightless Ghosts are severely weakened and damaged. Worse, should the Guardians be killed, then they will be unable to resurrect them. Fortunately, at least one Guardian was able to regain their Light from a broken shard of the Traveler in the European Dead Zone.
For a Guardian, their Ghost serves as a companion, scout, librarian, and mechanic, waking ancient machinery and cracking ancient codes. Ghosts can support Guardians by performing certain actions such as illuminating darkened areas, repairing technology from the Golden Age, hacking into machines, informing Guardians of incoming hostile threats, calculating complex enemy behaviors, determine combat outcomes, mapping numerous projectiles and their myriad of trajectories, and providing communications. Most importantly, Ghosts may revive Guardians from death. As long as the Ghost survives, and barring special circumstances, Guardians are effectively immortal and may be resurrected fully intact from any death without consequences. The death does not have to be immediate, nor do they have to be revived in the same place they died.  Ghosts may also repair any injury a Guardian suffers in a matter of seconds, though can sometimes have such difficulty repairing Exo Guardians that it is easier to resurrect from scratch.
Ghosts have no special control over their Guardians' actions, other than talking to them, or potentially withholding the resurrection of a Guardian who becomes dangerously erratic or monstrous. 
Ghosts serve the important function of a narrative device, acting as a vehicle for important tasks such as informing players of new objectives, and also serve as a revive/respawn marker when a player's character dies during cooperative play. Ghosts notify players when another player/Guardian has left the area or is revived. A Ghost can assist to more quickly revive another fallen player by holding the X button on the Xbox 360/One, the square button on the PlayStation 3/4, or the E key on PC. This can only be done in close proximity to a fallen player's death location, marked by his Ghost. On occasion, while on missions, certain objects must be scanned either to progress the narrative or provide additional context to the Guardian, which is visually represented as the Ghost flying out and scanning the object of interest. For example, scanning a dead Cabal on Phobos will have Ghost describe what legion it's from.
For more information, see Ghost Shells.
Ghost shells change the appearance of Ghosts. The Taken King adds defensive boosts and additional effects to ghost shells. Rare shells have a single perk, while legendary shells have several to choose from. Shells can be purchased from The Speaker, the Vanguards, or Lord Shaxx. As of Rise of Iron, Ghost shells marked with New Monarchy, Dead Orbit, or Future War Cult colors and symbols can be bought from faction representives.
Ghosts without listed Guardians are not known to have one, either stated outright or simply never mentioned.
List of appearances