yq Cheatsheet

Power user.

Overview

yq is the YAML processor that does for YAML what jq does for JSON. Mikefarah’s implementation uses jq-compatible syntax, which means fluency transfers directly. Five primitive surfaces cover almost every YAML manipulation operators need: read fields, modify in place, convert between YAML and JSON, handle multi-document streams, and chain transforms together.

The approach

Five expressions cover almost every operational use of yq. Memorising them turns YAML editing from a bug-prone shell exercise into reviewable transformations.

Why this compounds

Each yq one-liner replaces a manual edit or a fragile sed pattern. Config-management speed grows; CI scripts become readable. Modern infrastructure is YAML-first, which means fluency pays back across Kubernetes, GitHub Actions, GitLab CI, Helm values, and most cloud-config formats.