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

Previous:Updating YUM in Linux

Next: None

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

Updating YUM in Linux

Publish Date:2025/03/23 Views:148 Category:OPERATING SYSTEM

This article will teach us how to update YUM in Linux and how to install, update, remove, find and manage packages on a Linux system. We have also seen the difference yum update between and in Linux yum upgrade . yum update command in Linux

Installing Deb Files in Linux

Publish Date:2025/03/23 Views:93 Category:OPERATING SYSTEM

In this Linux article, we will learn how to install .deb (Debian Package) files on Linux systems. We will also see how to remove .deb files after installation. More importantly, we will learn different ways to install .deb files on Linux sy

lsof Command in Linux

Publish Date:2025/03/23 Views:100 Category:OPERATING SYSTEM

In this Linux article, we will learn about lsof command in Linux operating system. We will see how to use this command for different purposes in Linux. We use lsof the lsof command to verify the ports in use on the Linux operating system. U

ps aux command in Linux

Publish Date:2025/03/23 Views:57 Category:OPERATING SYSTEM

If you are using Linux and are looking for a tool that can monitor all the processes running on your system, then you should use the command ps aux. This command will show you an overview of all running processes. It is very useful for trou

NTP in Linux

Publish Date:2025/03/23 Views:58 Category:OPERATING SYSTEM

NTP is a core protocol used by most IT infrastructures. Its purpose is to synchronize date and time information. However, it is very important to configure NTP for your servers, clients, and other network devices. NTP uses a UDP port number

Creating a Progress Bar in Bash

Publish Date:2025/03/23 Views:94 Category:OPERATING SYSTEM

A progress bar is a visual indicator that shows the progress of a task, such as a long-running script or command. It can be used to provide feedback to the user about the status of a task and can also help estimate the time remaining before

Redirecting Stderr and Stdout to a file in Bash

Publish Date:2025/03/23 Views:187 Category:OPERATING SYSTEM

In this article, we will discuss standard output and standard error in Linux. We will see how to redirect standard output and standard error in Bash. Let us start by understanding the terms standard output and standard error in Linux. Stand

Scan to Read All Tech Tutorials

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

Recommended

Tags

Scan the Code
Easier Access Tutorial