4 Simple ways to check IP address in CentOS 7

4 Simple ways to check IP address in CentOS 7


This article is for CentOS users, will tell you 4 different ways to display your IP address in your terminal or CLI.

See also: NextJS - from React.js to an ultra-fast experience.


CentOS is one of the most reliable and stable Linux distros. It is preferred for the server OS. CentOS is the free version of Red Hat Linux and has features of it. It is an open-source operating system while the Red Hat is not. 

In this article, we will see the 4 basic ways of displaying your local IP address in the terminal of CentOS. I will use the command along with the grep to trim off the unnecessary information.

Method 1: Using the command ifconfig

Command ifconfig stands for interface configuration. It is the most commonly used command in the Linux universe. Running the command ifconfig | grep 192 will give the result IP address. As you can see below is the local IP address

ifconfig command to check ip

Method 2: Using command ip a

That's it, ip a. This is my favorite command and I personally use this command as it has only 4 characters (3 alphabets and one is space). Using it with grep will give you the following result

Method 3: Using the command nmcli

nmcli is a command-line tool to display the different network status, so IP too. So we can use this command to get our IP as follows.

Method 4: Using the command ip addr

This command is the same as ip a, or you can say the ip a is the short-hand command of ip addr command. So the output of this command is the same as that of ip a



© 2021 Garbage Valuegarbage value logo