...

/

Getting Our Connection Information

Getting Our Connection Information

Learn how to get our connection information.

Every computer connected to the internet or a TCP/IP network has an IP address. There are several methods we can use to determine ours from the command line.

The ifconfig command

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

sudo apt install net-tools

Once it’s installed, we run ifconfig:

ifconfig
Terminal 1
Terminal
Loading...

We see a bunch of output appear on the screen, starting with something like this:

Network information

The ifconfig command displays information about each network adapter available on the computer, along with its connection information and other relevant details. Each adapter has a name, like en0, eth0, or in this case, enp0s3.

The ifconfig command also shows each adapter, along with its IPv4 address, denoted by the inet field, the netmask, and the broadcast ...