A Go terminal UI for displaying network adapters in real time

Programming Snapshot – termui

Article from Issue 218/2019
Author(s):

Even command-line lovers appreciate a classic terminal UI. Mike Schilli shows how to whip up a Go program that dynamically displays network interfaces and IPs.

Every time I connect my laptop to a router for diagnostic purposes, the question arises: On which dynamically assigned IP address will the router see the laptop? After all, you need to enter a router address on the same subnet to display the router's admin page (Figure 1).

Figure 1: This machine uses an IP address on subnet 192.168.147.1/24 to connect to the router.

To do this, I used to type ifconfig several times in a terminal window and extracted the desired address from the mess of data printed next to:

[...]

Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Programming Snapshot – Go Network Diagnostics

    Why is the WiFi not working? Instead of always typing the same steps to diagnose the problem, Mike Schilli writes a tool in Go that puts the wireless network through its paces and helps isolate the cause.

  • Sweet Dreams

    Bathtub singer Mike Schilli builds a Go tool that manages song lyrics from YAML files and helps him learn them by heart, line by line.

  • Who's There?

    Rather than using Google Analytics to geolocate visitors to his website, Mike Schilli uses a simple terminal program in Go for a live-tracking session.

  • Manage your money with YNAB and Go-UI

    Mike Schilli uses the YNAB tool to keep an eye on his finances. Until recently, YNAB didn't have a terminal UI programmed in Go, but Mike delivers it here.

  • Network configuration with the versatile ipBasic Networking

    Network commands like ifconfig and route are still popular with users even though they are far past their prime. Their successor, ip, provides the capabilities of several legacy tools with a single, unified syntax.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News