CODE
channelBox -q -sma mainChannelBox
You can also try the other selection query flags:
-selectedMainAttributes (-sma) query
Returns a list of strings, the names of all the selected attributes in the top section of the channel box.
-selectedShapeAttributes (-ssa) query
Returns a list of strings, the names of all the selected attributes in the middle (shape) section of the channel box.
-selectedHistoryAttributes (-sha) query
Returns a list of strings, the names of all the selected attributes in the INPUT section of the channel box.
-selectedOutputAttributes (-soa) query
Returns a list of strings, the names of all the selected attributes in the OUTPUT section of the channel box.
See the MEL documentation for channelBox for more details.