Escaping the dungeon
Escaping the dungeon is a means of ending a NetHack game without quitting, dying, or ascending. There are three ways to escape the dungeon in normal gameplay. The easiest and most obvious is simply to climb the staircase on level 1 without the Amulet of Yendor. Alternatively, you can teleport to any level from −1 to −9 while flying or levitating, or to any negative level while wearing an amulet of life saving. Finally, you can reach the Astral Plane and sacrifice the Amulet of Yendor to the wrong god, which results in "escaping the dungeon in celestial disgrace".
In explore mode, you can offer the Amulet of Yendor to Moloch and refuse to die to both of his attempts to kill you. If you do, you will then be ejected from the dungeon in "a cloud of black smoke". In wizard mode, you can wish for a magic portal, which will lead to nowhere and cause you to escape the dungeon when activated.