yq - Parse YAML file using Mike Farah's yq CLI

by
Jeremy Canfield |
Updated: October 11 2024
| yq articles
Mike Farah's yq CLI and jq are similar, where Mike Farah's yq CLI is meant to parse YAML and jq is meant to parse JSON.
If you do not have Mike Farah's yq CLI installed on your Linux system, check out my article FreeKB - yq - Install Mike Farah's yq CLI.
Let's say my.yml contains the following.
foo: hello
bar: world
Here is how to parse the entire YAML file.
~]$ yq eval . my.yml
foo: hello
bar: world
Here is how to return the value of the "foo" key.
~]$ yq eval .foo my.yml
hello
Did you find this article helpful?
If so, consider buying me a coffee over at