• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Set or Change Timezone on Ubuntu 20.04

Written by Admin, Updated On May 4, 2020
terminal, timezone, ubuntu
How to Set or Change Timezone on Ubuntu 20.04

This guide explains how to set or change the timezone on Ubuntu 20.04 system. Correct system timezone is the very important because it’s not just displaying time but it do a lot more. If the time zone is not set correctly, it can have an impact on server logs, reporting, email, and file timestamps.

Timezone is very important to run all the reminders and cron jobs properly at expected time. Therefore, it’s a very essential step to set a right time zone on your Ubuntu system. We can change timezone via both GUI and command line.

Check Current Timezone#

timedatectl command-line utility is used to get and set system’s timezone easily. Execute the following command in order to view the current time zone information:

timedatectl

It should display output as below:

               Local time: Fri 2020-05-02 10:00:19 UTC
           Universal time: Fri 2020-05-02 10:00:19 UTC
                 RTC time: Fri 2020-05-02 10:00:19
                Time zone: UTC (UTC, +0000)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

The /etc/localtime is a link to the original timezone file. You can check the symbolic link using the following command:

ls -l /etc/localtime
lrwxrwxrwx 1 root root 01 May 21 20:21 /etc/localtime -> /usr/share/zoneinfo/UTC

Timezone Config Files of Ubuntu#

  • /usr/share/zoneinfo/ – Timezone name wise files are stored in this directory. For example, the file /usr/share/zoneinfo/America/New_York represents time zone for New York.
  • /etc/localtime – This is a symlink to the file localtime located in /usr/share/zoneinfo/ directory.

Change Timezone in Ubuntu#

At first, you should know long name for timezone for which you want to set. To get the list of all available timezones run below command:

timedatectl list-timezones

It will show output like below:

Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Bamako
Africa/Bangui
...
...
America/Caracas
America/Cayenne
America/Cayman
America/Chicago
America/Chihuahua
America/Costa_Rica
...
...
Pacific/Saipan
Pacific/Tahiti
Pacific/Tarawa
Pacific/Tongatapu
Pacific/Wake
Pacific/Wallis
UTC

Take the long name of timezone for your location, run the following command as root or user with sudo privileges.

The syntax for command is:

sudo timedatectl set-timezone NEW_TIME_ZONE

For example, to change timezone to America/New_York run command as below:

sudo timedatectl set-timezone America/New_York

Now, verify timezone again using timedatectl command:

timedatectl

It should changed with new timezone America/New_York.

               Local time: Fri 2020-05-02 06:10:49 UTC
           Universal time: Fri 2020-05-02 10:10:49 UTC
                 RTC time: Fri 2020-05-02 10:10:49
                Time zone: America/New_York (EDT, -0400)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

Change Timezone By Symlink#

Alternate way to change timezone is by creating a symlink. This method is useful when your server is running older version of Ubuntu or not have timedatectl command is available. We are going to change the timezone by creating symlink /etc/localtime to the timezone in the /usr/share/zoneinfo directory.

Determine timezone, which you want to set and create a symlink, type:

sudo ln -s /usr/share/zoneinfo/America/New_York /etc/localtime

To verify changes, list the /etc/localtime file or run the date command:

date
Tue May 02 06:37:22 EDT 2020

It should show new changed date and time with new timezone.

Conclusion#

You have learned how to view and change the timezone on the Ubuntu 20.04 Focal Fossa system.

Feel free to leave comment if you have any questions.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Install Nginx on Ubuntu 20.04
Next Article   How to Install and Use Curl on CentOS 8

Related Posts

  • How to Install and Use PHP Composer on Ubuntu 22.04

    How to Install Composer on Ubuntu 22.04

    January 31, 2023
  • How to Install Nginx on Ubuntu 22.04

    How to Install Nginx on Ubuntu 22.04

    January 28, 2023
  • How to Install Puppet Agent on Ubuntu 22.04

    How to Install Puppet Agent on Ubuntu 22.04

    January 22, 2023

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install SSH Keys on Ubuntu 22.04
    How to Set up SSH Keys on Ubuntu 22.04 January 7, 2023
  • How to Install Mongodb on Debian 11
    How to Install MongoDB on Debian 11 Linux January 11, 2023
  • How to Install Puppet Agent on Ubuntu 22.04
    How to Install Puppet Agent on Ubuntu 22.04 January 22, 2023
  • How to Install Python 3.11 on Debian 11
    How to Install Python on Debian 11 January 25, 2023
  • How to Change-Hostname Ubuntu 22.04
    How to Change Hostname on Ubuntu 22.04 January 19, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook