Skip to content

Instantly share code, notes, and snippets.

@toby-bro
Created February 18, 2026 18:30
Show Gist options
  • Select an option

  • Save toby-bro/3a13a1e8b018185fc7e0e806195e6240 to your computer and use it in GitHub Desktop.

Select an option

Save toby-bro/3a13a1e8b018185fc7e0e806195e6240 to your computer and use it in GitHub Desktop.
Pretty print the ip addresses associated with the different interfaces of a linux device
#!/bin/bash
# Print the table header
echo -e '╭─────────────────┬────────────────────╮'
echo -e '│ Interface │ IP Address │'
echo -e '├─────────────────┼────────────────────┤'
# Get the list of network interfaces and their IP addresses
ip -brief address | awk '{
printf "│ %-15s │ %-18s │\n", $1, $3
}'
echo -e '╰─────────────────┴────────────────────╯'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment