Back to Basics Part 6 -- Using the ip command in GNU/Linux for beginners

Mike Turcotte-McCusker
Apr 15, 2018
Updated • Apr 15, 2018

For years, people used the ifconfig tool to handle their command line IP / network interface related tasks.

However, ifconfig is long dead, and has since been replaced with the IP tool, although it will take users some time to make the total switch, as ip is considerably more powerful than ifconfig was.

This tutorial is geared to users who are not quite absolute CLI beginners, but are ready to start getting their toes wet when dealing with networking and interfaces.

IP Command in Linux


Getting right into it, the first command we will look at, checks all network interfaces, and shows information related to them such as IP address: ip addr show

Use the commands ip -4 a or ip -6 a to only show IPv4 or IPv6 related information

The same command can be used, to specifically look up information related to a certain interface. In this case, using wlp1s0 (wifi adapter) as the interface: ip addr show wlp1s0

Last but not least, you may also use it to show interfaces that are active: ip link ls up

Network interfaces

Enabling or disabling a network interface is also accomplished quite easily using the ip command (Note wlp1s0 is the name of the interface, and the up/down command enables or disables the interface on the device).

Enabling an interface (using the same interface from previous examples): ip link set wlp1s0 up

Disabling the very same interface: ip link set wlp1s0 down

You can use the IP command to set an IP address for the computer. The general command is ip a add IP/mask dev INTERFACE, e.g.: ip addr add dev wlan0

Or use the command to remove an IP address again by using the del command instead of add, e.g. sudo ip addr del dev wlan0

Other IP commands

To check the routing tables for your system, use:  ip route show

Just like with the 'addr show' options, we can also pinpoint routing information down to a specific IP address: ip route get  XXX.XXX.X.X #replace X with the desired IP address

Looking up network statistics is another extremely useful way to utilize the ip command, especially if you are under suspicions about packet loss occurring: ip -s link

You can also use the following command to quickly see all available options that ip can use: ip help

Lastly, but not least, you can use the manpages if you need more information, as ip can do much more powerful things than discussed here, as this was meant for beginners: man ip

And one more resource for you, is super handy cheatsheat that RedHat have put together, for using the ip command, found here.

Last words

Your typical home user will likely never need to actually use the ip command, for any of the usual day to day tasks.

However, as soon as you start delving into any form of server/sysadmin work, be it web hosting, or even just hosting a Minecraft server for you and your neighbour, you can quickly start tumbling down the networking rabbit hole; so learning the basics of ip as well as other tools like netstat or its replacement ss should be high on your priority list.

Back to Basics Part 6 -- Using the ip command in GNU/Linux for beginners
Article Name
Back to Basics Part 6 -- Using the ip command in GNU/Linux for beginners
The IP command tutorial is geared to users who are not quite absolute CLI beginners, but are ready to start getting their toes wet when dealing with networking and interfaces on GNU/Linux.
Ghacks Technology News

Previous Post: «
Next Post: «


  1. pebwindkraft said on October 7, 2019 at 7:24 pm

    appreciate your quick intro – triple like :-) It just reminded me to give it a try again. And (me) failed again – miserably. I can’t get into my head, why I should use an IP tool, to see the status of my device. It is not the same as with netstat – ss is much more an evolution of netstat than ip for ifconfig. Or is “ip” here a synonym for intellectual property? I go with John Fenderson’s comments. On OpenBSD I usually do ifconfig, my MacOS can do the same, so what is wrong with ifconfig. Ahhh, I see, it works… OK, I start to bang my head around this, and continue. I read the man page: there is ipx, decnet, bridge. Huh? All IP related, of course! Grrrr, WTF – no! And again an example, where Linux starts to create the same bullshit as Windows users already have. No – really! …so, you say, CISCO users have the same. Well, is this mimicking CISCO now? I will stay with ifconfig as long as can be, and then eat this mediocre Windows/CISCO shitty ip stuff – stop that rant here!

  2. John Fenderson said on April 16, 2018 at 7:12 pm

    “ifconfig is long dead, and has since been replaced with the IP tool”

    What, ifconfig is long dead? I use it every single day (as well as ip). It sure seems alive to me!

  3. sunscribe said on April 15, 2018 at 10:48 pm

    Enjoyed it, thanks.
    In case you want to get your DHCP-issued address back after experimenting:

    dhclient interface_name -v

  4. P said on April 15, 2018 at 7:49 pm

    Thanks! I need to bring my linux skills up to date.

  5. Paul(us) said on April 15, 2018 at 12:09 pm

    Really great series Mike, I wishing and hoping that you will keep this series up till everything (and I mean latterly everything) is explained. I think up to now there such a nice read because you are have written them in an understandable way!

    P.s. Did you notice that the picture (Under IP Command in Linux) fanned out to a format from 38.69 cm and with doing so blocked the advertisement part on the left side?

    1. Paul(us) said on April 15, 2018 at 12:14 pm

      Not fanned out to the left side (like I wrought earlier) but the right side and by doing so blocking the (right! :-) ) side advertisements.

      Hopefully, Martin will get the correcting possibility up and running again.

  6. Jilano said on April 15, 2018 at 10:19 am

    Good job, Mike! I love and bookmark all these articles on Linux. It can be really useful, especially for someone who just started.

    PS: There is an issue with the picture. It seems that she’s overlapping the right sidebar.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.