Interview Prep/Linux/Packages, Shell & Text Tools

What is `jq` and why is it essential for DevOps work?

IntermediateConceptPackages, Shell & Text Tools
Answer

jq is a command-line JSON processor; APIs, cloud CLIs and kubectl all emit JSON.

curl -s https://api.github.com/repos/torvalds/linux | jq '.stargazers_count'
aws ec2 describe-instances | jq -r '.Reservations[].Instances[] | "\(.InstanceId) \(.State.Name)"'
kubectl get pods -o json | jq -r '.items[] | select(.status.phase!="Running") | .metadata.name'

-r outputs raw strings without quotes.

All Linux questions Roadmap: Linux

More on Packages, Shell & Text Tools