An extended command is executed by pressing the # key followed by the command itself (the first letter or two should suffice). Extended commands exist because the developers of NetHack ran out of letters. They are supposedly less frequently used than the single-letter commands, but you probably won't get very far without using some of them.
Depending on how your game was compiled, these commands can vary or alternate keypresses may be available. On Nethack Qt for the Mac with no # key on the standard keyboard, the hash key is replaced with alt commands. If you are playing on the server, pressing alt+3 will produce the # symbol.
Extended commands in vanilla NetHack 3.4.3:
|adjust||Adjust inventory letters.|
|chat||Talk to someone.|
|conduct||List which challenges you have adhered to.|
|dip||Dip an object into something.|
|enhance||Advance or check weapons skills.|
|force||Force a lock.|
|invoke||Invoke an object's powers.|
|jump||Jump to a location.|
|loot||Loot a box on the floor.|
|monster||Use a monster's special ability.|
|name||Name an item or type of object.|
|offer||Offer a sacrifice to the gods.|
|pray||Pray to the gods for help.|
|quit||Exit without saving current game.|
|ride||Ride (or stop riding) a monster.|
|rub||Rub a lamp or a stone.|
|twoweapon||Toggle two-weapon combat.|
|version||List compile time options for this version of NetHack.|
|wipe||Wipe off your face.|
|?||Get this list of extended commands.|
Playing in wizard mode adds several extended commands.