cd command launches a shell in the chezmoi source directory, making it easy to work with your dotfiles using standard shell commands.
Usage
Description
Thecd command starts a new shell session in your chezmoi source directory (typically ~/.local/share/chezmoi). This is useful for performing version control operations, bulk edits, or other file management tasks.
When you exit the shell, you return to your original directory.
The environment variable CHEZMOI_SUBSHELL=1 is set in the launched shell, which you can use in your shell prompt or scripts to indicate you’re in a chezmoi subshell.
Arguments
Optional path to open. If provided, chezmoi will:
- Open the source directory if the path is the destination directory
- Open the corresponding source path if the path is a managed file
- If not specified, opens the root of the source directory
Configuration
Configure the shell to use in your config file:SHELL environment variable).
Examples
Open the source directory
~/.local/share/chezmoi.
Navigate to a specific file’s location
dot_bashrc in the source directory.
Use with git commands
Make bulk changes
Terminal Output
Shell Prompt Integration
You can modify your shell prompt to indicate when you’re in a chezmoi subshell:Bash
Zsh
Fish
Common Workflows
Version control operations
Search and replace across files
Review recent changes
Tips
Remember to run
chezmoi apply after making changes in the source directory if you want those changes reflected in your home directory.Alternative Approaches
Instead of usingcd, you can also: