Below you find a couple of oci cli commands and examples. Query syntax http://jmespath.org/examples.html#filters-and-multiselect-lists
list all activ compartments
oci iam compartment list --all --output table --compartment-id-in-subtree true \
--query "data [?\"lifecycle-state\" =='ACTIVE'].{Name:name,OCID:id}"
list all inactive compartments
oci iam compartment list --all --output table --compartment-id-in-subtree true \