jq

· 1 min read · Operating Systems and Virtualization · Tool

jq reads JSON on its input and applies a filter, like sed for JSON. It is the quickest way to extract an instance id from aws ec2 describe-instances or a field from kubectl get -o json.

Key concepts #

  • Filter: .items[].metadata.name.
  • Pipe, select, map: compose filters.
  • -r: print raw strings without quotes.

Learn it #

Follow the jq cheat sheet for the AWS CLI and kubectl.

#Jq #AWS #Linux