ip address show | flush

Look at protocol addresses or flush protocol addresses.
address can be abbreviated to a or addr

      ip address { show | flush } [ dev STRING ] [ scope SCOPE-ID ] [ to PREFIX ] [ FLAG-LIST ] [ label PATTERN ]

         IFADDR := PREFIX | ADDR peer PREFIX [ broadcast ADDR ] [ anycast ADDR ] [ label STRING ] [ scope SCOPE-ID ]

         SCOPE-ID := [ host | link | global | NUMBER ]

         FLAG-LIST := [ FLAG-LIST ] FLAG

         FLAG := [ permanent | dynamic | secondary | primary | tentative | deprecated ]

   dev NAME (default)
      name of device. 
   scope SCOPE_VAL
      only list addresses with this scope. 
   to PREFIX
      only list addresses matching this prefix. 
   label PATTERN
      only list addresses with labels matching the PATTERN. PATTERN is a usual shell style pattern. 
   dynamic and permanent
      (IPv6 only) only list addresses installed due to stateless address configuration or
      only list permanent (not dynamic) addresses. 
      (IPv6 only) only list addresses which did not pass duplicate address detection. 
      (IPv6 only) only list deprecated addresses. 
   primary and secondary
      only list primary (or secondary) addresses.
   -4  shortcut for -family inet. (IPv4)
   -6  shortcut for -family inet6. (IPv6)

ip address flush - flush protocol addresses.
This command flushes the protocol addresses selected by some criteria.
This command has the same arguments as show.
The difference is that it does not run when no arguments are given.

Warning: This command (and other flush commands described below) is pretty dangerous.
If you make a mistake, it will not forgive it, but will cruelly purge all the addresses.

With the -statistics option, the command becomes verbose.
It prints out the number of deleted addresses and the number of rounds made to flush the address list. If this option is given twice, ip addr flush also dumps all the deleted addresses in the format described in the previous subsection.


List and show all ip address associated on on all network interfaces:
$ ip addr
$ ip a

List the eth0 interface
$ ip a show eth0

“It is remarkable how easily and insensibly we fall into a particular route, and make a beaten track for ourselves” ~ Henry David Thoreau

Related linux commands

ip - Routing, devices and tunnels.
Equivalent Windows command: ROUTE - Manipulate network routing tables.

Copyright © 1999-2023 SS64.com
Some rights reserved