In Nethack, if you are standing upon the mystic word "Elbereth", most monsters will not be able to attack you hand-to-hand. They can still cast spells, zap wands and use ranged weapons. Some monsters are immune to the effects of Elbereth: anything represented by an @ sign (humans and elves), minotaurs, angelic beings, and the Riders (Death, Famine and Pestilence).

An engraving will protect you provided that it contains the case-insensitive string "elbereth", so since engravings are easy to erode, it may be wise to engrave "ElberethElberethElbereth" to make the protection last longer.

There are three main types of "engraving" - writing in the dust, engraving in the floor, or burning into the floor. Burned-in engravings are permanent and therefore the best type, and can be created with a wand of fire or lightning. Writing in the dust is the least permanent way. You can also use a magic marker, or write in blood while polymorphed into a vampire or demon.

You can write Elbereth in the dust with your fingers (or with a soft gem or most types of wand). However, there is a chance that you will mess it up. (You can also mess up engraving or burning into the floor if you are stunned, blind, or confused, and don't even bother trying while hallucinating.)

Any writing that isn't burned into the floor can be eroded by walking across it, fighting while standing on it, or even standing still on it. However, you won't erode your Elbereth if you levitate above it.

You can engrave Elbereth in the floor in one turn using a wand of digging or an athame (the only athame you can obtain without wishing now is Magicbane). Engraving with a wand uses a charge, but engraving with an athame won't dull it unless it's cursed. It's possible to engrave Elbereth with an ordinary +0 weapon, but not all at once - you must engrave "Elb", then "ere", then "th", and this will reduce the weapon's enchantment to -3. Finally, you can engrave it with a hard gem, but since this takes eight turns it's no use in an emergency.

Some of the information in this writeup was obtained from Kate Nepveu's Elbereth FAQ at http://www.steelypips.org/nethack/elbereth_faq.html