Open In App

How to change time zone from command line on RHEL 9

Last Updated : 13 Sep, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Correctly setting the time zone on a Red Hat Enterprise Linux (RHEL) 9 system is crucial for ensuring accurate time synchronization and proper functioning of various applications and services. While graphical tools are available for configuring the time zone, administrators often prefer command-line methods for efficiency and automation.

Here, we will explore how to change the time zone from the command line on RHEL 9, providing step-by-step instructions along with examples and explanations.

Understanding Time Zones on RHEL 9

Time zones define the local time for a particular region or geographical area, accounting for factors such as daylight saving time (DST) adjustments and offsets from Coordinated Universal Time (UTC). RHEL 9 uses the 'timedatectl' command-line utility to manage system time and time zone settings. This powerful tool allows administrators to view, set, and modify the system's date, time, and time zone configurations, making it a versatile choice for managing time-related settings on RHEL systems.

Steps to Change Time Zone on RHEL 9

Follow these steps to change the time zone from the command line on RHEL 9:

Step 1: Open Terminal

Begin by opening a terminal window on your RHEL 9 system. You can do this by clicking on the terminal icon in the desktop environment or by using the keyboard shortcut 'Ctrl + Alt + T'.

terminal of rhel9
terminal of rhel9

Step 2: View Current Time Zone

Before changing the time zone, it's a good practice to verify the current time zone settings. Use the following command to display the current time zone:

timedatectl
checking time zone in rhel9
checking time zone in rhel9


This command will output detailed information about the system's date, time, and time zone configuration, including the current time zone identifier (e.g., 'Asia/Kolkata').

Step 3: List Available Time Zones

To view a list of available time zones that can be set on your system, use the following command:

timedatectl list-timezones
listing time zone in rhel9
listing time zone in rhel9

This command will display a long list of time zone identifiers in alphabetical order. You can scroll through the list to find the desired time zone.

Step 4: Change the Time Zone

Once you've identified the desired time zone from the list, use the following command to set the new time zone:

sudo timedatectl set-timezone your_time_zone

Replace 'your_time_zone' with the identifier of the desired time zone (e.g., 'America/Los_Angeles'). You will need to prefix the command with 'sudo' to run it with administrative privileges.

Step 5: Verify the Time Zone Change

To confirm that the time zone has been successfully changed, re-run the 'timedatectl' command:

timedatectl

Check the output to ensure that the 'Time zone' field reflects the newly set time zone.

Conclusion

Changing the time zone from the command line on RHEL 9 using the 'timedatectl' utility is a process that allows administrators to efficiently manage system time configuration. By following the steps outlined here and using the provided examples, you can ensure accurate time synchronization and proper functioning of applications and services in your RHEL 9 environment.


Similar Reads