There are a number of menu accelerators that can be activated through the Nethack options. I believe menu_select_all is what you're looking for, though the others may be convenient too.
From the documentation:
- menustyle Controls the interface used when you need to choose various objects (in response to the Drop command, for instance). The value specified should be the first letter of one of the following: traditional, combination, partial, or full. Traditional was the only interface available for earlier versions; it consists of a prompt for object class characters, followed by an object-by-object prompt for all items matching the selected object class(es). Combination starts with a prompt for object class(es) of interest, but then displays a menu of matching objects rather than prompting one-by-one. Partial skips the object class filtering and immediately displays a menu of all objects. Full displays a menu of object classes rather than a character prompt, and then a menu of matching objects for selection.
- menu_deselect_all
Menu character accelerator to deselect all items in a menu. Implemented by the Amiga, Gem, X11 and tty ports. Default '-'.
- menu_deselect_page
Menu character accelerator to deselect all items on this page of a menu. Implemented by the Amiga, Gem and tty ports. Default '\'.
- menu_first_page
Menu character accelerator to jump to the first page in a menu. Implemented by the Amiga, Gem and tty ports. Default '^'.
- menu_invert_all
Menu character accelerator to invert all items in a menu. Implemented by the Amiga, Gem, X11 and tty ports. Default '@'.
- menu_invert_page
Menu character accelerator to invert all items on this page of a menu. Implemented by the Amiga, Gem and tty ports. Default '~'.
- menu_last_page
Menu character accelerator to jump to the last page in a menu. Implemented by the Amiga, Gem and tty ports. Default '|'.
- menu_next_page
Menu character accelerator to goto the next menu page. Implemented by the Amiga, Gem and tty ports. Default '>'.
- menu_previous_page
Menu character accelerator to goto the previous menu page. Implemented by the Amiga, Gem and tty ports. Default '<'.
- menu_search
Menu character accelerator to search for a menu item. Implemented by the Amiga, Gem and X11 ports. Default ':'.
- menu_select_all
Menu character accelerator to select all items in a menu. Implemented by the Amiga, Gem, X11 and tty ports. Default '.'.
- menu_select_page
Menu character accelerator to select all items on this page of a menu. Implemented by the Amiga, Gem and tty ports. Default ','.
So here's a table of the keybinds. Again, they only work on the X11 and console ports:
First page ^ Select all . Select page ,
Page up < Deselect all - Deselect page /
Page down > Invert all @ Invert page ~
Last page | Search :