Linux ipconfig equivalent

As Windows users migrate over to a Linux system, one of the first questions that arises is “what is the ipconfig Linux equivalent command?”

Much like Microsoft Windows, any Linux system can output all manner of information regarding the IP address and interface configuration via the command line.

In this tutorial, you will learn how to use the ip command, which is like the Linux version of the Windows ipconfig command.

In this tutorial you will learn:

  • How to use the Linux ipconfig command equivalent (the ip command)
Linux ipconfig equivalent
Linux ipconfig equivalent
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux system
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Linux ipconfig equivalent




As a Windows user, or former Windows user, you usually execute the ipconfig command to see IP addresses and related network information for all the interfaces on your system.

In Linux, the equivalent command is ip. You may also see the ifconfig command mentioned in some guides online, but that command has been deprecated and superseded by ip. All modern and up to date systems will use the ip command.

Check out some of the examples below to get acclimated with the ip command.

  1. The ipconfig /all command on Windows can be translated to ip address or simply ip a for short on Linux systems.
    $ ip a
    
    Output of the ip a command on Linux (equivalent to ipconfig /all on Windows)
    Output of the ip a command on Linux (equivalent to ipconfig /all on Windows)
  2. To display default gateway IP address, which is usually shown with ipconfig /all on Windows, run the ip r command on Linux.
    $ ip r
    
    Viewing the default gateway on Linux
    Viewing the default gateway on Linux
  3. Show only the IPv4 or IPv6 addresses with the -4 or -6 switch, respectively.
    $ ip -4 a
    OR
    $ ip -6 a
    
  4. If you want to show network information for a specific interface, just specify the name of that interface in your command. For example, this command will display information for the enp0s3 interface.
    $ ip a show enp0s3
    
  5. To show information only for active interfaces, and omitting information for the down interfaces, use the following command.
    $ ip link ls up
    
  6. To assign an IP address to a particular interface, you can use the following command syntax. In this example, we will set IP address 192.168.1.150 with subnet mask 255.255.255.0 on to interface enp0s3.
    $ sudo ip a add 192.168.1.150/255.255.255.0 dev enp0s3
    
  7. Similarly, you can remove the previous IP address from the interface with the same syntax but with the del option. In this example, we are using standard slash notation /24 to represent our subnet mask.
    $ sudo ip a del 192.168.1.150/24 dev enp0s3
    
  8. Use the following command syntax to enable (put up) a network interface. This example will put the enp0s3 interface up.
    $ sudo ip link set enp0s3 up
    
  9. Use the following command syntax to disable (put down) a network interface. This example will put the enp0s3 interface down.
    $ sudo ip link set enp0s3 down
    


NOTE
You can always use the man command to read more about the ip command and its official documentation. Click the previous link to see how to open the manual pages for any command on a Linux system.

Closing Thoughts

In this tutorial, we learned all about the ipconfig Linux equivalent command, which is ip. There is a lot of overlap between the ipconfig command on Windows and the ip command on Linux, so users should already have a jumpstart in understanding the ins and outs of Linux network configuration. You will find, though, that Linux has much more command options to learn and allows for much more granular control.



Comments and Discussions
Linux Forum