Show the kernel routing table with netstat
Build a paste-ready command, then review its compatibility and effects before running it.
read-onlyno known side effects Compatibility
Linux + macOSVerified for Linux, macOS using posix, bash, zsh syntax.
Operational knowledgereview due 2027-01-19
Requirementsnetstatnetstat must be installed and available on PATH.
Version supportnetstat Current supported releasesVerified for linux, macos using posix, bash, zsh syntax; consult compatibility notes for platform-specific differences.
Expected signalsKernel IP routing tableRepresentative successful output; values vary with the selected target and system state.
Known errorsnetstat: command not foundnetstat is missing or is not available on PATH.
Verifynetstat -rnThe output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01netstatCommandRuns the netstat stage of this one-liner.
02-rnOptionDisplays the routing table numerically without resolving hostnames.
Example output
Kernel IP routing table
Destination Gateway Genmask Flags Iface
0.0.0.0 10.0.0.1 0.0.0.0 UG eth0
10.8.0.0 0.0.0.0 255.255.255.0 U tun0
Illustrative output — exact values vary by system and data.
Official sources
Related commands