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

How to Change Timezone on Ubuntu 18.04

Written by Admin, Updated On May 7, 2019
terminal, timezone, ubuntu
How to Change Timezon on Ubuntu 18.04

Timezone is set at the time of installation of Ubuntu OS and you also can change it later. It’s very important aspect to set up a proper timezone for applications which are based on cron jobs and the timestamps. This tutorial will describe multiple ways to change timezone on Ubuntu 18.04 system.

Prerequisites#

Make sure that you are logged in as a user account with sudo privileges.

Get Current Timezone#

Commanly, timedatectl command is same for all Linux distributions and used to get and set system’s timezone easily. Execute the below command to get current timezone:

timedatectl

It will display output as below:

                      Local time: Tue 2019-04-30 11:57:15 IST
                  Universal time: Tue 2019-04-30 06:27:15 UTC
                        RTC time: Tue 2019-04-30 06:27:15
                       Time zone: Asia/Kolkata (IST, +0530)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

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 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 long name of timezone which you want to set and run the following command as with sudo user.

The basic syntax for command is:

sudo timedatectl set-timezone NEW_TIME_ZONE

For example, if your required timezone is America/New_York then you can set it by running command as below :

sudo timedatectl set-timezone America/New_York

Now verify timezone again using timedatectlcommand:

timedatectl

It should changed with new timezone America/New_York.

                      Local time: Wed 2019-04-30 02:30:39 EDT
                  Universal time: Wed 2019-04-30 06:30:39 UTC
                        RTC time: Wed 2019-04-30 06:30:39
                       Time zone: America/New_York (EDT, -0400)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

Change Timezone By Symlink#

Another 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.

First, you need to delete current /etc/localtime symlink or file by typing:

sudo rm -rf /etc/localtime

After that, add the timezone which you want to set and creating a symlink:

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

Now, if you want to verify it you can do it by listing the /etc/localtime file or run the date command:

date

It will show below output:

Output
Tue Apr 30 02:37:22 EDT 2019

Conclusion#

Finally, you have learned how to change timezone in Ubuntu 18.04. If you have any question you can leave comment below.

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 Set Up SSH Keys on CentOS 7
Next Article   How to Install Skype on CentOS 7 System

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 Jenkins on Debian 11
    How to Install Jenkins on Debian 11 January 5, 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