What is IP Address –
A unique number consisting of four parts separated by dots. Every device on the Internet (and on any network) must have a unique IP address to participate and be part of it. An example of an IP address is: 192.168.1.1.
This article will show you how to find the IP address of your local machine through command line in LINUX. To get your internal IP, you can run the following commands:
Example 1 – Ifconfig
The ifconfig command is used to configure a network interface (that is, to associate an IP address with a network device). If you run ifconfig without any command-line arguments, the command displays information about current network interfaces.
Command: ifconfig
OR
Command: ifconfig -a
Example 2 – ip addr
To get the depth information of your network interfaces like IP Address, MAC Address information, use the following command as shown below.
Command: ip addr
Example 3 – hostname
The hostname command is used to show or set a computer’s host name and domain name. It is one of the most basic of the network administrative utilities.
Command: hostname -I
Example 4 – nmcli
nmcli is a command-line tool for controlling NetworkManager and reporting network status. It can be utilised as a replacement for nm-applet or other graphical clients.
It is also used to create, display, edit, delete, activate, and deactivate network connections, as well as control and display network device status.
Command: nmcli
Command: nmcli device show
Example 5 – ip route
IP route command is used to configure the static route. Static routes are the most secure way of routing. They will also increase overall network performance. These features are extremely helpful in small network.
Command: ip route get 1.2.3.4 | awk ‘{print $7}’
And with the help of below commands, you can easily get your external public IP address directly from the command line:
Commands:
You may also like:curl ipinfo.io/ip
curl ifconfig.me
dig +short myip.opendns.com @resolver1.opendns.com
curl checkip.dyndns.org
host myip.opendns.com resolver1.opendns.com
- Most Common DNS Record Types and Their Roles
- Top Skills Needed to Become a Cybersecurity Analyst
- Mastering Windows Management with WMIC Commands – Top 20 Examples
- Edit and Compile Code with the Best 5 Code Editors
- 50+ Top DevSecOps Tools You Need To Know
- Learn How to Add Proxy and Multiple Accounts in MoreLogin
- Some Useful PowerShell Cmdlets
- Create Free SSL Certificate – ZEROSSL.COM [2020 Tutorial]
- Generate Self-Signed SSL Certificate with OPENSSL in Kali Linux
- RDP – CredSSP Encryption Oracle Remediation Solution 2020