I didn’t know about this, so maybe will help other learners as well.
The command is:
daml damlc inspect .daml/dist/create-daml-app-0.1.0.dar | head -1.
The output is like this:
Found in the Trigger Service section of the docs.
The following command returns a big json which also contains the package id:
daml damlc inspect-dar .daml/dist/create-daml-app-0.1.0.dar --json