Beginning nethack, how to use bags

nethack

After scrutinising various lists of commands and browsing a few wikis, I am missing something obvious:

What commands do I use to put things into a bag, list the contents of a bag and take things out of a bag?

Best Answer

Containers (bags, boxes, chests, etc.) in your inventory are treated differently from those on the ground (which you can access using #loot command). For bags in your inventory, treat them like tools and use them with [a]pply. This will then bring up the menu to add, remove, or just view the items within.