How to Use the IP Command on Linux

Reading Time: 4 minutes

Hello Readers! In this blog we will see how to use the IP commands in Linux. So, first we will see what is an IP? An IP (Internet Protocol) addresses are used to identify hardware devices on a network. The addresses allow these devices to connect to one another and transfer data on a local network or over the internet.

Each address is a string of numbers separated by periods. There are four numbers in total and each number can range between 0 and 255. An example of an IP address would be: 506.457.14.512.

How to Use the ip Command:


OBJECTS (or subcommands) that you will use most often include:

1. link (l) – used to display and modify network interfaces.

2. address (addr/a) – used to display and modify protocol addresses (IP, IPv6).

3. route (r) – used to display and alter the routing table.

4. neigh (n) – used to display and manipulate neighbor objects (ARP table).

There are many other objects and commands available. To see a full list type in the following command:


To execute commands, you can use either full or abbreviated forms. For example, ip link and ip l will give the same results.

When configuring network interfaces, you must run the commands as root or a user with sudo privileges.

Manage and Display Network Interfaces:

You can get a list of all below-mentioned link command options and more by typing:


Get Network Interface Information:

To see link-layer information of all available devices (which have a driver loaded) use the command:

$ ip link show

If you want it to display the information for one specific device, type in the following:

$ ip link show dev [device]

To see statistics for all network interfaces (details such as transferred or dropped packets, or even errors) use:

$ ip -s link

You can also see similar information for an individual network interface with:

$ ip -s link ls [interface]

In case you need even more details, add another -s to the syntax:

$ ip -s -s link ls [interface]

To see a list of only the running interfaces use:

$ ip link ls up

Modify Network Interface Status:

If you want to bring a network interface up (online), use the command:

$ ip link set [interface] up

Disable an interface (offline) by entering:

$ ip link set [interface] down

The ip link command allows you to modify the transmit queue, speeding up or slowing down interfaces to reflect your needs and hardware possibilities.

$ ip link set txqueuelen [number] dev [interface]

Monitor and Manage IP Addresses:

Check out all below-mentioned address commands and more by typing the following:


Monitor IP Addresses:

Display all devices by using the following command:

$ ip addr

To list all network interfaces and the associated IP address, use the command:

$ ip addr show

You can also see information about an individual network:

$ ip addr show dev [interface]

To list the IPv4 addresses, use:

$ ip -4 addr

To list IPv6 addresses type:

$ ip -6 addr

How to Add IP Address in Linux:

Add an IP address to an interface using the command:

$ ip addr add [ip_address] dev [interface]

If you need to add a broadcast address to an interface use the command:

$ ip addr add brd [ip_address] dev [interface]

To remove an IP address from an interface type:

$ ip addr del [ip_address] dev [interface]

Display IP Routing Table:

List all the route entries use either of the following commands:

$ ip route

$ ip route list

With the commands above, the output displays all of the route entries in the kernel. If you need to narrow down the search, add the SELECTOR object:

$ ip route list SELECTOR

Modify IP Routing Table:

To add a new entry in the routing table that can be reached on a specific device, type in the command:

$ ip route add [ip_address] dev [interface]

Or you can add a new route via gateway by typing:

$ ip route add [ip_address] via [gatewayIP]

Also, the command allows you to add a route for all addresses via the local gateway by adding the default option:

$ ip route add default [ip_address] dev [device]

$ ip route add default [network/mask] via [gatewayIP]

To delete an existing entry in the routing table, use the commands:

$ ip route del [ip_address]


$ ip route del default

$ ip route del [ip_address] dev [interface]


Therefore, In this blog we have seen how to use the IP commands in linux. Now, you can easily use these commands. Thanks for being with me till the end. If you find this blog helpful do share with your friends.


Written by 

Naincy Kumari is a DevOps Consultant at Knoldus Inc. She is always ready to learn new technologies and tools. She loves painting and dancing.