JIYIK CN >

Current Location:Home > Learning > OPERATING SYSTEM >

How to get IP address in CentOS

Author:JIYIK Last Updated:2025/03/23 Views:

This short article is a brief introduction to CentOS followed by a brief discussion on how we can get the server IP address in CentOS using the Command Line Interface (CLI).

This article will discuss some of the commands and their usage for the above purposes. Let's start with an introduction to CentOS.


Introduction to CentOS

CentOS is the abbreviation of Community Enterprise Operating System. It is a Linux distribution created by Gregory Kurtzer. It provides free enterprise-level and is an open source operating system.

It works with Red Hat Enterprise Linux (RHEL), from which it is derived. RHEL is an enterprise-class operating system, but is not free and usually requires a paid subscription.

CentOS developers use RHEL source code to develop products that are closely related to RHEL. Only the community and portal provide technical support for this.

CentOS is one of the most stable and trusted Linux distributions available. It is the preferred server operating system.

CentOS is a free version of Red Hat Linux that includes some of its features. Unlike Red Hat, it is an open source operating system.


CentOS Architecture

Its underlying architecture is similar to all other Linux distributions. Similar to other distributions, it also supports only -86 and x64 bit architectures, which means it can run only on 32-bit and 64-bit platforms.

  1. The lowest layer includes physical and hardware devices such as computers, networks, and storage devices.
  2. On top of this, the kernel is placed. The kernel is the most fundamental part of the operating system as it interacts directly with the hardware.
  3. The next layer is the shell, which acts as an interface between the user and the kernel.
  4. The top layer is the application layer, which is used for interaction between the shell and the kernel to perform user-defined tasks such as file browsers, media players, text editing software, etc.

Advantages of using CentOS

  1. It's light, efficient and fast.
  2. It's open source and free, and is enterprise-ready.
  3. Some open source server software also comes pre-installed with version control tools such as Apache Web, CUPS, MySQL, and Git.
  4. Best possible community support, including the ability to submit bugs to bugs.centos.org.
  5. It contains almost the same features as the commercial Red Hat Enterprise Linux. It's also free!
  6. CentOS is often preferred over other open source and free Linux distributions (even over Ubuntu) due to its stability and less frequent package upgrades.

Get IP Address in CentOS

In a local network, private IP addresses are used for communication. Since private IP addresses cannot be routed, traffic from the external network cannot be transmitted to them.

You may need to know the private IP address of a system for a variety of reasons, including setting up network-related applications, enabling remote management, or troubleshooting.

Here are some ways to find your IP address using the command line interface (CLI).

Using ifconfig command

ifconfigIt is the abbreviation of Interface Configuration. This is the most widely used command in the Linux world.

Apart from the local IP address, it also provides us with many other network details, so to get the IP address, we will pipe it with grep to get the IP address accurately. This is depicted in the following image.

ifconfig command

Use ip a command

This is the simplest and shortest command to find the IP address. Just write three characters, ip a, and you will get the local IP address, as shown below.

ipa command

Using nmcli command

The nmcli command is used to find out the status of different networks and therefore also displays the IP address of that network. So this can also be used to find out the IP address.

nmcli command

Using the ip addr command

This does the same thing as the ip a command or we can say ip a is the shorthand for ip addr . The output of both the commands is same and can be used interchangeably.

ip address command

Using the hostname command

The hostname command is usually used to determine the hostname of a system. On the other hand, using the hostname command with the -l option can provide you with the IP address information.

hostname command

Using the ip route command

In Linux operating systems, the ip route command is used to configure and display static routes. This command also displays the private IP address of the system.

To find your private IP address, run the following command in your terminal.

ip route command

For reprinting, please send an email to 1244347461@qq.com for approval. After obtaining the author's consent, kindly include the source as a link.

Article URL:

Related Articles

How to decompress x.tar.xz format files under Linux

Publish Date:2025/04/08 Views:186 Category:OPERATING SYSTEM

A lot of software found today is in the tar.xz format, which is a lossless data compression file format that uses the LZMA compression algorithm. Like gzip and bzip2, it supports multiple file compression, but the convention is not to compr

Summary of vim common commands

Publish Date:2025/04/08 Views:115 Category:OPERATING SYSTEM

In Linux, the best editor should be vim. However, the complex commands behind vim's powerful functions also make us daunted. Of course, these commands do not need to be memorized by rote. As long as you practice using vim more, you can reme

Detailed explanation of command return value $? in Linux

Publish Date:2025/04/08 Views:58 Category:OPERATING SYSTEM

? is a special variable. This variable represents the return value of the previous command. That is to say, when we run certain commands, these commands will return a code after running. Generally, if the command is successfully run, the re

Common judgment formulas for Linux script shell

Publish Date:2025/04/08 Views:159 Category:OPERATING SYSTEM

In shell script programming, predicates are often used. There are two ways to use predicates, one is to use test, and the other is to use []. Let's take a look at how to use these two methods through two simple examples. Example 1 # test –

How to use the Linux file remote copy command scp

Publish Date:2025/04/08 Views:151 Category:OPERATING SYSTEM

Scp copies files between two hosts over the network, and the data is encrypted during transmission. Its underlying layer uses ssh for data transmission. And it has the same authentication mechanism and the same security level as ssh. When u

Scan to Read All Tech Tutorials

Social Media
  • https://www.github.com/onmpw
  • qq:1244347461

Recommended

Tags

Scan the Code
Easier Access Tutorial