cat command prints the target contents of one or more files, scripts, or symlinks. For templates, it shows the evaluated output.
Usage
Description
Thecat command displays what chezmoi would write to your destination directory for the specified targets. This is useful for:
- Templates: See the evaluated output without applying
- Encrypted files: View decrypted contents without saving to disk
- Scripts: Preview script contents
- Symlinks: Show symlink targets
chezmoi apply, this command doesn’t modify any files.
Examples
View a template’s output
~/.gitconfig is a template, this shows the evaluated version with all template variables replaced.
View an encrypted file
View multiple files
View a symlink target
Pipe to other commands
Compare template output with destination
Terminal Output
Use Cases
Debug templates
When a template isn’t evaluating correctly:Verify encryption
Check that a file is properly encrypted in the source:Preview before applying
Extract specific content
Template Debugging Example
Source template (dot_bashrc.tmpl):
Error Messages
If a target is not a file, script, or symlink:Related Commands
- apply - Apply the files shown by cat
- execute-template - Execute arbitrary templates
- diff - Show differences between target and destination