• Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How to Check IP Address on Linux using Command Line

Written by Rahul, Updated on February 6, 2018
Linux Commands ifconfig, ip, ip address, local ip

How to Check IP Address on Linux using Command Line? Mostly all of the Linux and Unix operating systems provides ifconfig and ip binary files. You can simply use these commands to find the local system IP address.

What is an IP Address?

A Internet Protocol address (IP address) is the numerical label assigned to each hardware devices connected to a computer network that uses the Internet Protocol to identify the devices. In general terms, it is an identity of any devices. An IP address allows a device to communicate with other devices over an IP-based network like the LAN or Internet.

  • Read: 5 Commands to Get Public IP using Linux Terminal

Method 1 – Using ifconfig Command

ifconfig command is generally available under /sbin directory. So you will need root or sudo access to run this on many of operating systems.

ifconfig

Sample output: [Some output hidden]

eth0      Link encap:Ethernet  HWaddr 00:0C:22:83:79:A3
          inet addr:192.168.10.199  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe89:79b3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3931508 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1333146 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:706273621 (673.5 MiB)  TX bytes:857722605 (817.9 MiB)
          Base address:0x2000 Memory:fd5c0000-fd5e0000

As per above output, this system has IP address 192.168.10.199 on Ethernet interface eth0.

You can also view the specific interface details by specifying interface name on the command line as below.

ifconfig eth0
  • Read: bash ifconfig: command not found on CentOS/RHEL 7

Method 2 – Using ip Command

ip command generally available under /bin directory but some Linux os keep is under /sbin directory. Use the following command to get ip address using ip command.

ip addr show

Sample output: [Some output hidden]

1: lo:  mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0:  mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:0C:22:83:79:A3 brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.199/24 brd 192.168.1.255 scope global eth0 
    inet6 fe80::20c:29ff:fe89:79b3/64 scope link
       valid_lft forever preferred_lft forever

As per above output, this system has IP address 192.168.10.199 on Ethernet interface eth0. The interface eth1 doesn’t configure with an IP address.

You can also view the specific itnerface details using below command

ip addr show eth0

Find more commands to check local ip address of any Linux system.

ip route get 1 | awk '{print $NF;exit}'
ip route get 8.8.4.4 | head -1 | cut -d' ' -f8
ip route get 8.8.4.4 | head -1 | awk '{print $7}'

Share it!
Share on Facebook
Share on Twitter
Share on Google+
Share on Reddit
Share on Tumblr
Rahul
Rahul
Connect on Facebook Connect on Twitter Connect on Google+

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

Related Posts

  • bash ifconfig: command not found on Debian Linux

    November 15, 2018
  • How To Check IP Address on Windows via Command Prompt

    November 11, 2018
  • How to Configure Static IP Address on Ubuntu 18.04 (Desktop)

    May 8, 2018
  • How to Check IP Address on Ubuntu 18.04 (Desktop)

    May 7, 2018
  • How to Setup Network Interface on Ubuntu, Debian & LinuxMint

    October 20, 2015

Leave a Reply

Cancel reply

Popular Posts

  • How to Setup Squid Proxy Server on Ubuntu 18.04 & 16.04
  • How To Install Zabbix Agent on Debian 9/8
  • How to Install and Configure Squid Proxy on Debian 9
  • How to Remove “public/index.php” from URL in Laravel
  • How To Install Wine 3 on Debian 9 (Stretch)
All rights reserved. © 2013-2018 TecAdmin.net. This site uses cookies. By using this website you agree our term and services