The widget commands all want a sidebar ID, and I never remember what a theme calls its sidebars. This command prints them.
wp sidebar list
By default you get name, id and description. The docs also list optional fields: class, before_widget, after_widget, before_title and after_title. The last four hold the HTML wrapper strings of the sidebar.
wp sidebar list --fields=name,id --format=csv
The docs show it like this:
name,id
"Widget Area",sidebar-1
"Inactive Widgets",wp_inactive_widgets
The ID column is what you hand to wp widget list. The formats are table (the default), csv, json, ids, count and yaml.
The caveat is --inactive, which lists only inactive sidebars. According to the docs it is not in a stable WP-CLI release yet. To use it you need the nightly build:
wp cli update --nightly
wp sidebar list --inactive --fields=id --format=csv
I’d only switch to nightly on a test site. For a normal check the plain command is enough.
Once you have the ID, the docs show wp widget list sidebar-1 --fields=name,id --format=csv, which prints one line per widget in that sidebar, for example search,search-3. The widget list command accepts the same --fields and --format options.
Further reading: wp sidebar list