Back to Chezmoi

`chattr` *modifier* *target*...

assets/chezmoi.io/docs/reference/commands/chattr.md

2.70.21.9 KB
Original Source

chattr modifier target...

Change the attributes and/or type of targets. modifier specifies what to modify.

See attributes for a description of each attribute.

Add attributes by specifying them or their abbreviations directly, optionally prefixed with a plus sign (+). Remove attributes by prefixing them or their attributes with the string no or a minus sign (-). The available attribute modifiers and their abbreviations are:

Attribute modifierAbbreviation
aftera
beforeb
emptye
encryptednone
exactnone
executablex
externalnone
onceo
onchangenone
privatep
readonlyr
removenone
templatet

The type of a target can be changed using a type modifier:

Type modifier
create
modify
script
symlink

The negative form of type modifiers, e.g. nocreate, changes the target to be a regular file if it is of that type, otherwise the type is left unchanged.

Multiple modifications may be specified by separating them with a comma (,). If you use the -modifier form then you must put modifier after a -- to prevent chezmoi from interpreting -modifier as an option.

Common flags

-r, --recursive

--8<-- "common-flags/recursive.md:default-false"

Examples

sh
chezmoi chattr template ~/.bashrc
chezmoi chattr noempty ~/.profile
chezmoi chattr private,template ~/.netrc
chezmoi chattr -- -x ~/.zshrc
chezmoi chattr +create,+private ~/.kube/config