In this tutorial, you will learn how to check and set your Timezone in CentOS.
timedatectl command is a relatively new addition to Systemd distributions, and provides a much simpler interface for viewing and adjusting a server’s date and time.
CentOS and RedHat still use symbolically linked files to set the system’s timezone. You will also learn how to view this linked file and how to update your timezone by changing the link.
Check Current Timezone with Timedatectl
To get detailed information your CentOS server’s date, time, and timezone you use the
timedatectl command. In the example below, we can see the server’s time zone is America/New_York, and the offset is -0400.
Local time: Fri 2020-09-04 23:44:41 EDT
Universal time: Sat 2020-09-05 03:44:41 UTC
RTC time: Sat 2020-09-05 03:44:39
Time zone: America/New_York (EDT, -0400)
System clock synchronized: no
NTP service: active
RTC in local TZ: no
Setting Timezone with Timedatectl
In order to set your timezone you should probably list the available zones. You can view a list of supported timezones using the
timedatectl list-timezones command.
The list is fairly comprehensive. You could browse the list by piping the
timedatectl command into the
If you have an idea which timezone you want, you can pipe
timedatectl into the
timedatectl list-timezones | grep America
Once you have the timezone you want to set the system to, you use the
timedatectl set-timezone command with the name of the timezone. For example, to set the server’s timezone to America/Phoenix, you would run the following command.
sudo timedatectl set-timezone America/Phoenix
Setting Timezone with Symbolic Link
The timezone on a RedHat and CentOS server is stored set by the
/etc/localtime file. This file is actually a symbolic link to a timezone file under
To get a basic view of the timezone you can
ls the file to it’s symbolic link.
ls -la /etc/localtime
lrwxr-xr-x 1 root wheel 41 30 Aug 22:12 /etc/localtime -> /var/db/timezone/zoneinfo/America/Toronto
In the example above, we can see the
/etc/localtime file is symbolically linked to the
America/Toronto timezone file.
To change the timezone, replace the symbolic link with that of the correct timezone file for your server.
sudo ln -sf /usr/share/zoneinfo/America/Phoenix
ln command is used to create file links, while the
-s flag is used to set the link type as symbolic and the
-f flag forces the creation, which is required to update an existing link.