[email protected]Office hours: Mon – Fri 9:00AM – 5:00PMLinkedInXFacebook
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 startedMay 30, 2023

How To Set or Change Timezone on Debian 9.

How To Set Or Change Timezone On Debian 9.

Using the correct timezone is important for many systems related tasks and processes. For example, the cron daemon uses the system’s timezone for executing cron jobs and the timestamps in the log files are based on the same system’s timezone.

The system’s timezone is set during the installation, but it can be easily changed at a later time. This tutorial shows how to set or change the timezone on Debian 9.

 

Prerequisites

The user you are logged in as must have sudo privileges to be able to change the system’s timezone.

 

Checking the Current Timezone

In Debian and other modern Linux distributions, the timedatectl command allows you to display and set the current system’s time and timezone.

timedatectl

As shown on the output below, the system’s timezone is set to “America/Chicago”:

      Local time: Mon 2019-03-11 16:46:45 CDT
  Universal time: Mon 2019-03-11 21:46:45 UTC
        RTC time: Mon 2019-03-11 21:46:45
       Time zone: America/Chicago (CDT, -0500)
 Network time on: yes
NTP synchronized: no
 RTC in local TZ: no

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

ls -l /etc/localtime
lrwxrwxrwx 1 root root 37 Jan 23 03:19 /etc/localtime -> ../usr/share/zoneinfo/America/Chicago

 

Changing Timezone in Debian

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

To list all available time zones, you can either list the files in the /usr/share/zoneinfo directory or use the timedatectl command.

timedatectl list-timezones
...
Europe/Bucharest
Europe/Ljubljana
Europe/London
Europe/Luxembourg
Europe/Madrid
Europe/Malta
...

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

sudo timedatectl set-timezone your_time_zone

For example, to change the system’s timezone to Europe/Ljubljana you would run:

sudo timedatectl set-timezone Europe/Bucharesst

Verify the change by issuing the timedatectl command:

timedatectl
      Local time: Mon may 11 22:55:04 EST 2023
  Universal time: Mon may 11 22:55:04 2023 UTC
        RTC time: Mon may 11 22:55:04
       Time zone: Europe/Bucharest (EST, +0100)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: no

 

If you are running an older version of Debian and the timedatectl command is not present on your system you can change the timezone by symlinking /etc/localtime to the timezone in the /usr/share/zoneinfo directory.

Delete the current /etc/localtime file or symlink:

sudo rm -f /etc/localtime

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

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

You can confirm the change either by listing the /etc/localtime file or issuing the date command:

date
Mon may 11 22:55:04 EST 2023

 

Conclusion

In this guide, you learned how to change your Debian system’s timezone.

Keep reading
How to Implement Network Segmentation and Resource Isolation in Linux.
February 6, 2024

How to Implement Network Segmentation and Resource Isolation in Linux.

How to Implement Network Segmentation and Resource Isolation in Linux. Securing and managing networks in a Linux environment involves advanced practices like network segmentation and resource isolation. This guide explores these concepts, providing detailed instructions and examples for…

Read article
How to open or close ports in Linux.
February 6, 2024

How to open or close ports in Linux.

How to open or close ports in Linux. Effectively managing ports on your Linux system is crucial for both security and service accessibility. This comprehensive guide will provide a detailed walkthrough on opening and closing ports using the robust tools iptables and ufw. Understanding these…

Read article
How to use ypdomainname command.
January 23, 2024

How to use ypdomainname command.

How to use ypdomainname command. In the realm of Linux networking, the ypdomainname command plays a crucial role in the context of the Network Information Service (NIS). NIS, formerly known as Yellow Pages, is a distributed database service that facilitates the sharing of network configuration and…

Read article
Get in Touch

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

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

Get Started →Contact Us
[email protected]Office hours: Mon – Fri 9:00AM – 5:00PM