LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

crudini

Get and set values in INI-style config files

TLDR

Get a parameter
$ crudini --get [file.ini] [section] [param]
copy
Set a parameter
$ crudini --set [file.ini] [section] [param] [value]
copy
Delete a parameter
$ crudini --del [file.ini] [section] [param]
copy
Merge INI from stdin into a file
$ crudini --merge [file.ini] < [snippet.ini]
copy
Set a global (no section) parameter
$ crudini --set [file.ini] "" [param] [value]
copy

SYNOPSIS

crudini --set|--get|--del|--merge [*options*] *config_file* ...

DESCRIPTION

crudini manipulates INI configuration files from the shell: get/set/delete parameters, operate on sections, and merge fragments. Useful in provisioning scripts that must edit .ini files without brittle sed. Requires Python iniparse.

PARAMETERS

--get *file* [*section*] [*param*]

Read a value or list sections/keys.
--set *file* *section* [*param*] [*value*]
Create/update a value. Empty section "" targets global keys.
--del *file* *section* [*param*]
Remove a parameter or section.
--merge *file* [*section*]
Merge INI data from stdin.
--existing
Fail if the item does not already exist.
Multiple operations can be combined per invocation; see crudini --help.

INSTALL

sudo apt install crudini
copy
sudo dnf install crudini
copy
sudo zypper install crudini
copy
nix profile install nixpkgs#crudini
copy

CAVEATS

INI dialects differ (duplicate keys, multiline, nested sections). Always test on copies of production configs. Not a general TOML/YAML editor.

SEE ALSO

augtool(1), sed(1), git-config(1)

RESOURCES

Copied to clipboard
Kai