Filter language
About 945 words
The --filter flag of the list commands takes a filt-rs expression. It works the same on clients get, devices get, ports get, events get and on get of every configuration subject.
unifi clients get --filter 'type == "WIRELESS" && experience < 60'
unifi devices get --filter 'name startswith "ap" && uptime < 1d'
unifi networks get --filter 'vlanId >= 20'Put the whole expression in single quotes for your shell: <, >, |, & and " mean something to it otherwise. --filter has no short form: -f means --filename on apply, diff and create, and --follow on events get. Shell completion offers the field names of a command, then the operators, then && and ||.
Expressions
A filter is one expression, and a record matches when the expression is true. Conditions combine with && (and), || (or) and ! (not), and parentheses group them:
unifi clients get --filter '(vlan == 10 || vlan == 20) && !blocked'A field on its own is true when it holds something: --filter blocked lists blocked clients and --filter '!enabled' disabled objects. An empty expression matches everything.
Values
| Value | Examples | Notes |
|---|---|---|
| Text | "Core Switch" | Always in double quotes. Escape an embedded quote as \". |
| Number | 42, 99.5 | No unary minus: write 0 - 70 for -70. No exponents. |
| Boolean | true, false | |
| Null | null | What a field the record doesn't have reads as. |
| List | ["IoT", "Cameras"] | For in. |
| Duration | 90s, 5m, 2h, 1h30m, 7d, 2w | m is minutes. |
A bare word is a field name, never text: type == WIRELESS compares two fields. Write type == "WIRELESS".
Operators
| Operator | Meaning |
|---|---|
==, != | Equal, not equal. Text compares ignoring case. |
<, <=, >, >= | Order numbers, durations and timestamps. |
contains | Text contains a substring, or a list contains a value. |
in | A value is in a list: vlan in [10, 20]. |
startswith, endswith | Text starts or ends with a prefix or suffix. |
like | Glob match with * and ?: name like "camera *". |
matches | Regular expression, case-sensitive: name matches "^ap-[0-9]+$". |
+, - | Arithmetic on numbers, durations and timestamps. |
The text operators ignore case. Each one except matches has a case-sensitive form with a _cs suffix, such as contains_cs.
Fields
A field is the JSON field name of the record, as --output json shows it. Each command's --help lists its fields.
- Lookup ignores case as well as
-and_:rxBytes,rxbytes,rx_bytesandrx-bytesname the same field. - A dotted path descends into nested objects:
uplink.deviceName == "Core Switch". - A path that crosses a list gives the list of values below it. Search it with
in,containsorlike:"6GHz" in radios.bandfinds access points with a 6 GHz radio. - A field the record doesn't have is
null.
A field that no listed object has is an error that names the closest known field.
Durations and timestamps
uptime on devices is a duration and compares with a duration: uptime < 7d. Timestamps such as connectedAt on clients and time on events compare with the built-in time functions:
| Function | Meaning |
|---|---|
now() | The current time. |
ago(1h) | The current time minus a duration. |
datetime("2026-03-14T08:00:00Z") | A point in time. Give a full timestamp; a date alone reads as null. |
unifi clients get --filter 'connectedAt > ago(1h)'
unifi events get --filter 'time > datetime("2026-03-14T08:00:00Z")'Sizes, rates and addresses
unifi-cli adds three functions to the language:
| Function | Meaning |
|---|---|
size("1.5GB") | Bytes. B, K/KB, M/MB, G/GB, T/TB are powers of 1000; KiB, MiB, GiB, TiB powers of 1024. |
rate("100Mbps") | Bits per second: bps, Kbps, Mbps, Gbps, Tbps. |
ip("192.168.1.10") | An IP address that orders by address. Use it on both sides of a comparison. |
Units ignore case. A text that isn't a size, rate or address gives null, which matches nothing.
unifi clients get --filter 'rxBytes > size("100GB")'
unifi clients get --filter 'txRateBps > rate("20Mbps")'
unifi clients get --filter 'ip(ip) >= ip("192.168.1.10") && ip(ip) < ip("192.168.1.50")'Without ip(), addresses compare as text, which puts 192.168.1.100 before 192.168.1.9.
Examples
| Goal | Command |
|---|---|
| Wireless clients with a weak signal | unifi clients get --filter 'type == "WIRELESS" && signalDbm < 0 - 70' |
| Clients on a guest SSID | unifi clients get --filter 'ssid contains "guest"' |
| Clients whose name mentions a word | unifi clients get --filter 'name contains "camera"' |
| Clients on one of two networks | unifi clients get --filter 'network in ["IoT", "Cameras"]' |
| Clients that downloaded more than 100 GB | unifi clients get --filter 'txBytes > size("100GB")' |
| Clients on one switch | unifi clients get --filter 'uplinkDeviceName == "Core Switch"' |
| Clients that connected in the last hour | unifi clients get --filter 'connectedAt > ago(1h)' |
| Switches under load | unifi devices get --filter 'type == "switch" && cpuPercent > 50' |
| Devices on old firmware | unifi devices get --filter 'version startswith "6."' |
| Access points with a 6 GHz radio | unifi devices get --filter '"6GHz" in radios.band' |
| PoE ports drawing more than 10 W | unifi ports get --filter 'poeWatts > 10' |
| Linked ports below gigabit | unifi ports get --filter 'speedMbps < 1000 && up' |
| Disabled firewall policies | unifi firewall policies get --filter '!enabled' |
| DNS records pointing at one host | unifi dns get --filter 'ipv4Address == "192.168.40.10"' |
In the interactive shell
show clients in unifi shell takes the same expressions: show clients network == "IoT". The shell reads | as a pipe and > as a redirection, so put a filter that holds either in single quotes: show clients 'experience > 90 || guest'.
Filters, shortcut flags and sorting
Shortcut flags such as --wireless, --offline or --poe combine with --filter; all of them must match. --sort and --limit apply after filtering, so --filter 'network == "IoT"' --sort usage --limit 5 is the five heaviest clients on the IoT network.
