Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/twpayne/chezmoi/llms.txt

Use this file to discover all available pages before exploring further.

The managed command (also available as list) lists all files, directories, and symlinks managed by chezmoi.

Usage

chezmoi managed [path]...

Description

The managed command displays all entries that chezmoi manages in your destination directory. You can optionally specify paths to list only managed entries under those paths.

Flags

-x, --exclude
types
Exclude entry types (comma-separated: dirs, files, remove, scripts, symlinks, always, encrypted, externals, templates).
-f, --format
string
default:"text"
Output format. Options: text, json, yaml.
-i, --include
types
Include only specified entry types (comma-separated: dirs, files, remove, scripts, symlinks, always, encrypted, externals, templates).
-0, --nul-path-separator
boolean
default:"false"
Use NUL character as path separator. Useful for piping to xargs -0.
-p, --path-style
string
default:"relative"
Path style to use. Options:
  • relative - Paths relative to home directory
  • absolute - Absolute paths
  • source-relative - Paths relative to source directory
  • source-absolute - Absolute paths in source directory
  • all - All path information in structured format
-t, --tree
boolean
default:"false"
Print paths as a tree structure.

Examples

List all managed files

chezmoi managed
Output:
.bashrc
.gitconfig
.ssh/config
.vim/vimrc
.zshrc

List with absolute paths

chezmoi managed --path-style=absolute
Output:
/home/john/.bashrc
/home/john/.gitconfig
/home/john/.ssh/config
/home/john/.vim/vimrc
/home/john/.zshrc

List in tree format

chezmoi managed --tree
Output:
.
├── .bashrc
├── .gitconfig
├── .ssh
│   └── config
├── .vim
│   └── vimrc
└── .zshrc

List only files (exclude directories)

chezmoi managed --include=files

List managed files in a specific directory

chezmoi managed ~/.config
Output:
.config/nvim/init.vim
.config/tmux/tmux.conf

List source paths

chezmoi managed --path-style=source-relative
Output:
dot_bashrc
dot_gitconfig
private_dot_ssh/config
dot_vim/vimrc
dot_zshrc

Export to JSON

chezmoi managed --path-style=all --format=json
Output:
{
  ".bashrc": {
    "absolute": "/home/john/.bashrc",
    "sourceAbsolute": "/home/john/.local/share/chezmoi/dot_bashrc",
    "sourceRelative": "dot_bashrc"
  },
  ".gitconfig": {
    "absolute": "/home/john/.gitconfig",
    "sourceAbsolute": "/home/john/.local/share/chezmoi/dot_gitconfig",
    "sourceRelative": "dot_gitconfig"
  }
}

Use with xargs

chezmoi managed --nul-path-separator | xargs -0 ls -l
Safely pass managed files to other commands, even if filenames contain spaces.

Count managed files

chezmoi managed | wc -l

Find large managed files

chezmoi managed --path-style=absolute | xargs ls -lh | sort -k5 -h

Output Examples

Default (relative paths)

$ chezmoi managed
.bashrc
.config/nvim/init.vim
.gitconfig
.ssh/config
.vimrc

Tree view

$ chezmoi managed --tree
.
├── .bashrc
├── .config
   └── nvim
       └── init.vim
├── .gitconfig  
├── .ssh
   └── config
└── .vimrc

Source paths

$ chezmoi managed --path-style=source-relative
dot_bashrc
dot_config/nvim/init.vim
dot_gitconfig.tmpl
private_dot_ssh/config
dot_vimrc

Filtering Examples

List only template files

chezmoi managed --include=templates

List only encrypted files

chezmoi managed --include=encrypted

List everything except scripts

chezmoi managed --exclude=scripts

List only directories

chezmoi managed --include=dirs

Scripting Examples

Backup all managed files

tar czf dotfiles-backup.tar.gz -C ~ $(chezmoi managed)

Check permissions of managed files

chezmoi managed --path-style=absolute | xargs stat -c '%n %a'

Search for a pattern in managed files

chezmoi managed --include=files | \
  xargs -I {} grep -l "pattern" ~/{}  

Common Use Cases

Verify what’s managed

Check which files chezmoi is tracking:
chezmoi managed | grep -E "\.(bash|zsh|vim)rc"

Compare with actual files

# List managed files
chezmoi managed > /tmp/managed.txt

# List actual files
find ~ -type f > /tmp/actual.txt

# Compare
comm -3 /tmp/managed.txt /tmp/actual.txt

Export inventory

Create a manifest of managed files:
chezmoi managed --path-style=all --format=yaml > inventory.yaml
  • unmanaged - List unmanaged files
  • status - Show status of managed files
  • add - Add new files to be managed

Build docs developers (and LLMs) love