Ghosts are most likely to appear in bones levels, copies of levels where previous players died. Most causes of death will leave a player ghost behind; see the article on bones files for more information and exceptions. These ghosts are generated asleep on top of their original inventories, and has the same experience level as the late player; their pet(s) may be nearby, and are very likely to have turned feral. Any objects that were carried in the deceased player's main inventory have an 80% chance of becoming cursed, even if they were originally blessed. Other objects on the level and the contents of containers in the player's inventory maintain their BUC status.
Ghosts will also appear in graveyards, and occasionally spawn when you step into haunted temples. A ghost is generated on the Rogue level, Asmodeus' Lair, and Baalzebub's Lair each. In Gehennom, many ghosts are generated in the Valley of the Dead's three large graveyards.
Quaffing a milky potion may cause a ghost to appear.
Ghosts of past players found in bones files are named after the dead adventurer they represent. The ghost generated on the Rogue level is named Michael Toy, Kenneth Arnold, or Glenn Wichman.
Ghosts created on other special levels have a 1/7 chance of being given your character's name. Otherwise, they are given a random name from the following list:
Ghosts are very slow and do very little damage, and in most scenarios involving a bones pile they can usually be led away with little trouble. However, they possess a very low AC, and will likely evade most attacks if met at a low experience level. If you are unable to dispatch them via regular attack, kicking them may work instead. Even though the ghost may not be too difficult to dispatch, be wary that you do not forget about their original killer - you may very well become a ghost yourself if you are careless and the monster is still present.
By default, ghosts and shades are represented by a blank space, making them difficult to see and almost impossible to locate by telepathy. Some players use the SYMBOLS option to give ghosts and shades a different appearance, such as X or 8. This makes them easier to see and allows you to shortly identify bones levels via telepathy.
When a player leaves a bones file, one leaves a corpse and a ghost under regular circumstances; if you use undead turning on the corpse, the ghost inhabits the player's corpse on the item pile, removing the ghost. If successful, the message "<Name>'s ghost is suddenly drawn into its former body!" is displayed.
The ghost must be on or adjacent to the square the corpse is on, and must be awake to be turned. The corpse can be of a polymorphed form if the target died while in another form, e.g. from wearing an amulet of unchanging. If the ghost is tame, then the resulting monster is tame, and is otherwise generated peaceful or hostile as normal based on your alignment and race. The monster will also be confused upon resurrection.
In xNetHack, the ghost's base level is reduced to 4, their speed is increased to 5, their AC is increased to 5, and their magic resistance is increased to 80.
Instead of their 1-damage touch attack, hostile ghosts turn invisible every so often and try to frighten the player by reappearing next to them. When this happens, the player is paralyzed for three turns. This is not prevented by free action, but it will not work if the player is able to sense the invisible ghost. 1⁄3 of ghosts will generate invisible.
And now the souls of the dead who had gone below came swarming
up from Erebus -- fresh brides, unmarried youths, old men
with life's long suffering behind them, tender young girls
still nursing this first anguish in their hearts, and a great
throng of warriors killed in battle, their spear-wounds gaping
yet and all their armor stained with blood. From this
multitude of souls, as they fluttered to and fro by the
trench, there came a moaning that was horrible to hear.
Panic drained the blood from my cheeks.