How to check and change time zone on CentOS Stream 9

Estimated reading: 2 minutes 823 views

On CentOS, the system time zone is set during installation, but can easily be changed afterwards. This article describes how to set or change the time zone on CentOS Stream 9.

1.Check current time zone

timedatectl is a command-line utility that allows you to view and change the system’s time and date. It is available on all modern systemd-based Linux systems:

# timedatectl

The output shows the system’s timezone. In this example the timezone is set to Europe/Berlin :

 

 

The system timezone is configured by symlinking /etc/localtime to a binary timezone identifier in the /usr/share/zoneinfo directory. Another option to check the timezone is to show the path the symlink points to using the ls command:

$ ls -l /etc/localtime

Output:

lrwxrwxrwx. 1 root root 35 Dec 16 2022 /etc/localtime -> ../usr/share/zoneinfo/Europe/Berlin

2. Changing Timezone in CentOS

Before changing the timezone, you’ll need to find out the long name for the timezone you want to use. The timezones are using “Region/City” format.

To list all available time zones invoke the timedatectl command with the list-timezones option:

 $ timedatectl list-timezones

Output:

Once you identify which time zone is accurate to your location, run the following command as root or user with sudo privileges :

$ timedatectl set-timezone your_time_zone

For example, to change the system’s timezone to America/Phoenix

$ timedatectl set-timezone America/Phoenix

After run the timedatectl command to verify the changes:

In conclusion, configuring the time zone in CentOS Steam 9 other RHEL-based systems is a straightforward process that can be performed by following these simple steps. Keeping the system time in sync with the correct time zone helps to enhance the reliability of your systems and avoid confusion.

 

Leave a Comment

Share this Doc

How to check and change time zone on CentOS Stream 9

Or copy link

CONTENTS