Information commands
CentOS provides system administrators with a range of commands for obtaining information about various aspects of the system, including hardware, software, networks, and users. These commands are essential tools for monitoring and troubleshooting the system and its components, providing insight into the current status, configuration, and performance of the system. With the ability to obtain accurate and up-to-date information about the system, system administrators can quickly identify and resolve issues, ensuring optimal performance and the stability of the system. These commands provide information about the system’s hostname, disk usage, processes, CPU, and network interfaces, respectively, making them valuable tools for system administrators who need to diagnose and resolve system issues.
Here are a few commonly used information commands in CentOS:
uname
: Theuname
command is used to display information about the operating system and the system’s hostname. This command can also display the type of hardware, the version of the operating system, and the release number of the kernel.
Figure 1.38 – Displaying the operating system
The uname
command comes with different flags that can be executed; for example, the -a
parameter displays the whole information, including the system name, network node hostname, kernel release, version, and machine hardware name, as we can see in the following terminal:
Figure 1.39 – Displaying all system information
lsb_release
: Thelsb_release
command is used to display information about the Linux Standard Base (LSB) version, distributor ID, and release number. The LSB is a standard that defines the Linux operating system and ensures compatibility among different Linux distributions.
Figure 1.40 – Displaying the Linux Standard Base version
To execute additional flags, we’ll make use of a flag commonly used by administrators to display the distributor indicator.
Figure 1.41 – Displaying Distributor Indicator
hostnamectl
: Thehostnamectl
command is used to display and modify the system hostname and to view various system settings such as the operating system architecture, boot mode, and system time zone. This command is useful for changing the hostname or viewing system settings without having to log in to the system as a root user.
Figure 1.42 – Displaying the system settings and architecture
Let us execute hostnamectl
with another flag, set-hostname
. This flag is used to set the system hostname to a specified value. For example, you might execute hostnamectl
set-hostname myhost
:
Figure 1.43 – Setting a system hostname
The preceding useful information commands that we covered in this section will help you gather information about your system. Throughout this chapter, we emphasized the importance of proper server setup and installations, including regular software upgrades and updates, to ensure that your system runs smoothly and remains secure. By following the steps outlined in this chapter, you will be well on your way to setting up a reliable and secure server for your personal use, as well as building a foundation to further learn about Linux system administration.