Getting Your Connection Information

Every computer connected to the Internet or a TCP/IP network has an IP address, and there are several methods you can use to determine yours from the command line.

The ifconfig command is a legacy command that displays information about your network devices. While there are newer tools available, you’re going to start by exploring this tool because it’s universally available on Mac and Linux. On Ubuntu 18.04, you’ll need to install the net-tools package to use it:

 $ ​​sudo​​ ​​apt​​ ​​install​​ ​​net-tools

Once it’s installed, run ifconfig:

 $ ​​ifconfig

You’ll see a bunch of output appear on the screen, starting with something that looks like this:

 enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> ...

Get Small, Sharp Software Tools now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.