unifi known-clients
About 1522 words
Manage client records: aliases, fixed IPs and notes.
Aliases: known-client
Manage the controller's records of known clients, online or not: the alias shown instead of the hostname, a fixed IP address handed out by DHCP, and a note.
A record is named by the client's MAC address. For the clients connected right now, and for blocking or reconnecting them, use unifi clients.
This kind is served by the controller's internal API.
Commands
unifi known-clients create: Create a known clientunifi known-clients delete: Delete one or more known clientsunifi known-clients describe: Show every field of one known clientunifi known-clients edit: Edit a known client in your editorunifi known-clients get: List the known clients, or show oneunifi known-clients set: Change fields of a known client
unifi known-clients create
Create a known client.
Usage
unifi known-clients create <mac> [flags]Create a known client from flags, from a file, or from both.
--set path=value sets any field; address nested fields with dots. Values are read as YAML, so 20 is a number, true a boolean and [a,b] a list. -f reads a manifest or a bare spec (-f - reads standard input); flags are applied on top of it. With a manifest that carries metadata.name, the name argument can be left out.
The quickest way to a valid spec is an existing object: unifi known-clients get <mac> --output yaml.
Examples
unifi known-clients create aa:bb:cc:dd:ee:ff --alias "Living Room TV"
unifi known-clients create aa:bb:cc:dd:ee:ff --filename known-clients.yaml
unifi known-clients create aa:bb:cc:dd:ee:ff -f - < spec.yamlFlags
| Flag | Description |
|---|---|
--alias <string> | name shown instead of the hostname |
-f, --filename <file> | read the object from a manifest or spec file; - reads standard input |
--fixed-ip <string> | IP address DHCP always hands to the client |
--force | send fields that no object of the kind on this site has, instead of refusing them as typos |
--note <string> | free-text note |
--set <path=value> | set a field: path=value, repeatable; the value is read as YAML, so numbers, booleans and lists like [a,b] work |
--set-stdin <path> | set the field at this path to what arrives on standard input, for secrets; on a terminal it is asked for, masked |
-y, --yes | do not ask for confirmation |
unifi known-clients delete
Delete one or more known clients.
Usage
unifi known-clients delete <mac>... [flags]Aliases: rm
Delete one or more known clients after confirmation.
Every name is checked before anything is deleted, so a typo deletes nothing. Pass --yes to skip the confirmation, as scripts must. When several objects share a name, --id picks the one to delete.
Examples
unifi known-clients delete aa:bb:cc:dd:ee:ff
unifi known-clients delete aa:bb:cc:dd:ee:ff --yesFlags
| Flag | Description |
|---|---|
--id <id> | pick the object by its id, for objects that share a name |
-y, --yes | do not ask for confirmation |
unifi known-clients describe
Show every field of one known client.
Usage
unifi known-clients describe <mac> [flags]Show every field of one known client.
The kinds people look at most are laid out in words, with references shown by name; the others list their fields under the paths that unifi known-clients set <mac> --set <path>=<value> takes. --output yaml always prints the complete object as the controller spells it.
Secrets such as passphrases and keys read <redacted>. --show-secrets prints them in --output yaml and --output json, never in the text view. When several objects share the name, --id picks one.
Examples
unifi known-clients describe aa:bb:cc:dd:ee:ff
unifi known-clients describe aa:bb:cc:dd:ee:ff --output json
unifi known-clients describe --id <id>Flags
| Flag | Description |
|---|---|
--id <id> | pick the object by its id, for objects that share a name |
--show-secrets | print secrets in yaml and json output instead of <redacted>; they end up in your terminal, its scrollback and any file you redirect to |
unifi known-clients edit
Edit a known client in your editor.
Usage
unifi known-clients edit <mac> [flags]Open a known client as a YAML manifest in your editor and apply it on save.
The editor is taken from $VISUAL, then $EDITOR, then vi. What you save becomes the object's new state: removing a field removes it. Closing without changes, or emptying the file, cancels the edit.
Secrets such as passphrases and keys are shown as <redacted>. Leave that as it is to keep a secret, or type a new value over it to change it.
When the result is not a valid manifest or the controller rejects it, your edits are kept in a file whose path is printed, so nothing is lost.
Examples
unifi known-clients edit aa:bb:cc:dd:ee:ff
unifi known-clients edit aa:bb:cc:dd:ee:ff # with EDITOR="code --wait"Flags
| Flag | Description |
|---|---|
--force | send fields that no object of the kind on this site has, instead of refusing them as typos |
--id <id> | pick the object by its id, for objects that share a name |
-y, --yes | do not ask for confirmation |
unifi known-clients get
List the known clients, or show one.
Usage
unifi known-clients get [mac] [flags]Aliases: list, ls
List the known clients of the site, or show the one named by the argument.
--output wide adds columns and the object IDs. --output yaml and --output json print manifests that unifi apply -f - accepts unchanged.
--show-secrets keeps passphrases, keys and other secrets in --output yaml and --output json; without it they read <redacted>, which unifi apply understands as "keep the current value". Tables never show secrets.
--filter takes a filter expression such as enabled && name contains "guest". Fields are the object's own, as shown by --output yaml, plus name and id. --sort takes a column: name, alias, fixed-ip, blocked, note, or any field path.
Examples
unifi known-clients get
unifi known-clients get --output wide
unifi known-clients get aa:bb:cc:dd:ee:ff --output yaml
unifi known-clients get --filter 'blocked'
unifi known-clients get --output yaml > known-clients.yamlFlags
| Flag | Description |
|---|---|
--filter <string> | filter expression, such as 'enabled && name contains "guest"' |
--id <id> | pick the object by its id, for objects that share a name |
--reverse | reverse the sort order |
--show-secrets | print secrets in yaml and json output instead of <redacted>; they end up in your terminal, its scrollback and any file you redirect to |
--sort <string> | sort by a column or field path: name, alias, fixed-ip, blocked, note |
unifi known-clients set
Change fields of a known client.
Usage
unifi known-clients set <mac> [flags]Change fields of a known client and show what changed.
--set path=value sets any field; address nested fields with dots. Values are read as YAML, so 20 is a number, true a boolean and [a,b] a list (a list replaces the whole field). --unset path removes a field. --dry-run shows the change without making it.
Find the field paths with unifi known-clients get <mac> --output yaml.
Examples
unifi known-clients set aa:bb:cc:dd:ee:ff --fixed-ip 192.168.20.50
unifi known-clients set aa:bb:cc:dd:ee:ff --set <path>=<value> --dry-run
unifi known-clients set aa:bb:cc:dd:ee:ff --unset <path>Flags
| Flag | Description |
|---|---|
--alias <string> | name shown instead of the hostname |
--dry-run | show what would change without changing it |
--fixed-ip <string> | IP address DHCP always hands to the client |
--force | send fields that no object of the kind on this site has, instead of refusing them as typos |
--id <id> | pick the object by its id, for objects that share a name |
--note <string> | free-text note |
--set <path=value> | set a field: path=value, repeatable; the value is read as YAML, so numbers, booleans and lists like [a,b] work |
--set-stdin <path> | set the field at this path to what arrives on standard input, for secrets; on a terminal it is asked for, masked |
--unset <path> | clear a field by its path, repeatable: the controller's internal API keeps the key and stores an empty value |
-y, --yes | do not ask for confirmation |
Global flags
These flags are accepted by every command.
| Flag | Description |
|---|---|
--color-scheme <string> | color scheme: auto, dark or light |
--context <string> | context to use instead of the current one |
--no-cache | ask the controller for everything instead of using cached answers |
-o, --output <string> | output format: text, wide, json, yaml (table is another name for text) |
-s, --site <string> | site to act on instead of the context's default site |
--theme <string> | theme to render with instead of the configured one |
