[email protected]Support 24/7 · Billing 09:00 – 00:00LinkedInXFacebook
NexonHost
Netherlands Dedicated ServersAmsterdam · Equinix AM6Germany Dedicated ServersFrankfurt · Equinix FR4Romania Dedicated ServersBucharest · VoxilityAustria Dedicated ServersVienna · Interxion VIEBulgaria Dedicated ServersSofia · TelepointFrance Dedicated ServersParis · Interxion PAR — Marseille · Digital Realty MRS3Ireland Dedicated ServersDublin · Equinix DB2Italy Dedicated ServersMilan · Irideos AvalonPoland Dedicated ServersWarsawSpain Dedicated ServersMadrid · Equinix MD2United States Dedicated ServersAshburn · Equinix DC
All articles
Getting startedMarch 7, 2023

How to Set or Change the Time Zone in Linux

How To Set Or Change The Time Zone In Linux

This tutorial covers the steps necessary to set or change the time zone in Linux.

A time zone is a geographic region that has the same standard time. Typically the time zone is set during the installation of the operational system, but it can be easily changed at a later time.

 

Checking the 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.

To view the current time zone, invoke the timedatectl command without any options or arguments:

timedatectl
      Local time: Tue 2023-03-07 13:19:17 EST
  Universal time: Tue 2023-03-07 18:19:17 UTC
        RTC time: Tue 2023-03-07 18:19:17
       Time zone: America/New_York (EST, -0500)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: no
 Last DST change: DST ended at
                  Sun 2022-11-06 01:59:59 EDT
                  Sun 2022-11-06 01:00:00 EST
 Next DST change: DST begins (the clock jumps one hour forward) at
                  Sun 2023-03-12 01:59:59 EST
                  Sun 2023-03-12 03:00:00 EDT                    

The output above shows that the system’s time zone is set to UTC.

The system time zone is configured by symlinking the /etc/localtime file to a binary time zone’s identifier in the /usr/share/zoneinfo directory.

Another way to check the time zone is to view the path the symlink points to using the ls command:

ls -l /etc/localtime
lrwxrwxrwx. 1 root root 38 Sep 25  2021 /etc/localtime -> ../usr/share/zoneinfo/America/New_York

 

Changing the Time Zone in Linux

Before changing the time zone, you’ll need to find out the long name of the time zone you want to use. The time zone naming convention usually uses a “Region/City” format.

To view all available time zones, use the timedatectl command or list the files in the /usr/share/zoneinfo directory:

timedatectl list-timezones
...
Europe/Bucharest
Europe/Budapest
Europe/Busingen
Europe/Chisinau
Europe/Copenhagen
...

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

sudo timedatectl set-timezone Europe/Bucharest

For example, to change the system’s timezone to Europe/Bucharest you would type:

sudo timedatectl set-timezone Europe/Bucharest

To verify the change, invoke the timedatectl command again:

timedatectl
   Local time: Tue 2023-03-07 20:26:16 EET
  Universal time: Tue 2023-03-07 18:26:16 UTC
        RTC time: Tue 2023-03-07 18:26:16
       Time zone: Europe/Bucharest (EET, +0200)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: no
 Last DST change: DST ended at
                  Sun 2022-10-30 03:59:59 EEST
                  Sun 2022-10-30 03:00:00 EET
 Next DST change: DST begins (the clock jumps one hour forward) at
                  Sun 2023-03-26 02:59:59 EET
                  Sun 2023-03-26 04:00:00 EEST
                    

Mission accomplished! You’ve successfully changed your system’s time zone.

 

If you are running an older Linux distribution and the timedatectl utility is not present on your system, you can change the timezone by symlinking /etc/localtime to the time zone in the /usr/share/zoneinfo directory.

Remove the current symlink or file:

sudo rm -rf /etc/localtime

Identify the timezone you want to configure and create a symlink :

sudo ln -s /usr/share/zoneinfo/Europe/Bucharest /etc/localtime

Verify it either by listing the /etc/localtime file or invoking the date command:

date

The output includes the time zone, in this example that is “EST”.

Tue 2023-03-07 18:26:16

 

Conclusion

To change the time zone in Linux systems use the sudo timedatectl set-timezone command followed by the long name of the time zone you want to set.

Keep reading
How to Extract and Create RAR Files.
October 6, 2023

How to Extract and Create RAR Files.

How To Extract And Create RAR Files. Usually, you’ll come across the .zip or .gz compressed files. However, every now and then, you’ll also encounter RAR files in Linux. Dealing with RAR files in the Linux command line is not that complicated. You extract RAR files with the unrar command: unrar x…

Read article
How to use mmv command in Linux.
October 6, 2023

How to use mmv command in Linux.

How To Use Mmv Command In Linux. In the world of Linux and UNIX-based operating systems, managing files and directories is an essential part of the user experience. One critical aspect of managing these resources is renaming them to better organize or reflect changes in content. Manually renaming…

Read article
How to get Real Visitors IPs on your backend
October 5, 2023

How to get Real Visitors IPs on your backend

How to Get Real Visitor IPs in Web Server Access Logs In order to receive the real visitor IPs in your back-end’s access logs when using our remote protection services, your web server must be able to parse X-Forwarded-For headers. Some web servers, such as LiteSpeed, NGINX and IIS support this by…

Read article
Get in Touch

Together, Let’s Build a Faster, Safer Internet.

Build scalable infrastructure with NexonHost — high-performance dedicated servers, VPS hosting, cloud hosting, and DDoS protection across Europe.

Get Started →Contact Us
[email protected]Support 24/7 · Billing 09:00 – 00:00