commands
ip — Inspect and manage network state
iproute2 interface for addresses, links, neighbors and routing. show/get inspect; add/delete/set may change live state. -4 selects IPv4; -o uses one-line output. Use a fresh private workspace; live operations are VM-only.
Formal Syntax & Structure
linux syntaxlinux
ip [OPTIONS] OBJECT COMMANDParameters & Attributes
| Name | Type | Description |
|---|---|---|
| OBJECT | operand | address, link, route or neigh |
| COMMAND | operand | Operation |
| -4 | option | IPv4 |
| -o | option | One-line output |
Return Value
exit status and output
iproute2 interface for addresses, links, neighbors and routing. show/get inspect; add/delete/set may change live state. -4 selects IPv4; -o uses one-line output.
Working Example
Example Snippetlinux
ip -4 -o addr show dev lo | awk '{print $4}'