This article is for CentOS users, will tell you 4 different ways to display your IP address in your terminal or CLI.
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.
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 192.168.122.1
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
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.
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