Disable all unused interfaces with one command.

Hello,
How do I disable all unused interfaces with one command?
I searched the forum but found nothing.
Thanks for your reply

interface disable [find where running=no]

Define unused?

If you mean , not “Running”,

:foreach i in=[/interface find where running=no] do={/interface ethernet set $i disabled=yes}

Why all that code for one simple thing?

Is better: for each item finded not running on interfaces go on interface ethernet and set on that interface ID the attribute disabled equal to yes
(this give error for each non-ethernet interface finded not running that give a non-ethernet ID to ethernet-set)

or simply: on interfaces disable all that not running


# all interfaces (also bridges, pppoes, pptps, eoips, etc.)
/interface disable [find where !running]

# only ethernet / sfp
/interface disable [find where type=ether and !running]

# only wireless
/interface disable [find where type=wlan and !running]

# ethernet/sfp and wireless
/interface disable [find where type~"^(ether|wlan)\$" and !running]

Thank you all for your reply.
This helped me.