Overview
YAML is a human-friendly data serialization format for configuration files.
Why It Matters
YAML is widely used for configuration files in Kubernetes, Docker Compose, and CI/CD systems.
Essential Commands
yq . config.yamlPretty-print YAML structure
yq ".services.web.image" docker-compose.ymlRead nested YAML value
yq ".version = "3.9"" -i docker-compose.ymlUpdate field in-place
yamllint config.yamlLint YAML file for syntax/style issues
yq -o=json . config.yamlConvert YAML to JSON
yq ".items[] | .name" data.yamlIterate over array values
Quick Start
Start with the use proper indentation and structure
Key Concepts
Use proper indentation and structure
Understand lists, dictionaries, and scalars
Handle special characters and multiline strings
Pro Tips
- Combine multiple commands for powerful workflows
- Use aliases to speed up your command entry
- Create scripts to automate repetitive tasks
Common Pitfalls to Avoid
- • Forgetting to check the documentation for edge cases
- • Running commands without understanding their full impact
- • Not testing changes in a safe environment first