Created
February 18, 2026 18:30
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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