uci
Manage system configuration settings
TLDR
Fetch a value
List all options and their values
Set a value
Add a new section
Delete a section or value
Commit changes
Discard uncommitted changes
Display help
SYNOPSIS
uci command [options] [arguments]
PARAMETERS
show [config[.section[.option]]]
Displays the current configuration, or a specific part of it, in a human-readable format.
get config[.section[.option]]
Retrieves the value of a specific configuration option and prints it to standard output.
set config.section.option=value
Sets the value of a configuration option. This change is staged and not immediately written to disk.
add config.section=type
Adds a new unnamed section of a specified type to a configuration file. Returns its generated reference.
add_list config.section.option=value
Adds a new value to a list type option, appending it to the existing values. Use for options that can hold multiple entries.
del_list config.section.option=value
Removes a specific value from a list type option.
delete config[.section[.option]]
Deletes a configuration option, an entire section, or even a whole configuration file. This change is staged.
rename config.section=name
Renames an unnamed (anonymous) section to a named section, or renames an existing named section.
commit [config]
Saves all pending (uncommitted) changes to the configuration files on disk. If a specific config is given, only changes for that config are saved.
revert [config]
Discards all pending (uncommitted) changes, reverting to the last committed state for the specified config or all configs.
export [config]
Exports the configuration in a more verbose, scriptable format to standard output. Useful for backup or transfer.
import [config]
Imports configuration data from standard input, typically from an exported UCI format. Changes are staged.
changes [config]
Displays a summary of all pending, uncommitted changes for a specific configuration or all configurations.
batch
Enters an interactive batch mode, allowing multiple UCI commands to be executed sequentially, useful for complex operations.
DESCRIPTION
The uci (Universal Configuration Interface) command is the primary tool for managing system configurations on OpenWrt and similar embedded Linux distributions.
It provides a centralized, consistent, and scriptable way to interact with configuration files, typically located in /etc/config/.
UCI simplifies complex configuration tasks by abstracting the underlying file structure, allowing users and scripts to easily read, modify, and commit changes for various services like networking, wireless, firewall, and more.
Changes made with uci are stored in a staging area and must be explicitly committed to become permanent on disk, and often require a service restart to take effect.
CAVEATS
The uci command is specific to OpenWrt and other embedded Linux distributions that utilize the UCI system.
It is generally not found on standard desktop or server Linux distributions like Debian, Ubuntu, or Fedora.
Remember that changes made with uci set, add, delete etc., are only temporary until uci commit is explicitly executed to write them to disk.
After committing changes, a relevant service often needs to be reloaded or restarted (e.g., /etc/init.d/network reload, wifi reload, or service firewall restart) for the new configuration to take effect in the running system.
CONFIGURATION FILE LOCATION
UCI configuration files are typically found in the /etc/config/ directory.
Each file usually corresponds to a major service or component (e.g., /etc/config/network, /etc/config/wireless, /etc/config/firewall).
The file format is simple, human-readable, and designed for easy parsing by the UCI system, consisting of sections and options.
APPLYING CHANGES
After using uci commit to save changes to disk, it's almost always necessary to reload or restart the affected service for the new configuration to become active in the running system.
For example, after modifying network settings, one might use /etc/init.d/network reload or wifi reload to apply them.
Without a service restart, the running system may continue to use its old configuration.
HISTORY
The uci system was developed specifically for the OpenWrt project to provide a unified, command-line interface for managing the router's configuration.
It emerged from the need for a simple, yet powerful, configuration mechanism suitable for resource-constrained embedded devices, making it easy for both users and scripts to interact with settings without directly editing diverse and often complex configuration files from various services.
Its design focuses on consistency and atomicity of changes, ensuring configurations remain stable even across multiple modifications, a significant improvement over manual file editing.