.sort will list all unique items in your backpack.  Select an item to move all items of that same type to the toplevel of your pack. Type ".sort bag" to specify a container.
