How to set or modify the time zone on Ubuntu 20.04

Using the correct time zone is essential for system-related tasks and processes. For example, the cron daemon uses the system time zone to perform timing tasks, and the timestamp in the log is also based on the same system time zone.

On Ubuntu, the system time zone is usually set during installation, but it can be easily modified later.

This article describes how to use the command line or GUI interface to set or modify the time zone on Ubuntu 20.04.

1. Prerequisites##

Set or modify the system time zone as root or another sudo user.

Second, check the current system time zone##

timedatectl is a command line tool, which allows you to view or modify the system time and date. It can be used in all modern System-based Linux systems, including Ubuntu 20.04.

To print the current system time zone, run timedatectl without parameters.

timedatectl

The following output shows that the system time zone is set to "UTC":

    Local time: Wed 2020-05-0619:33:20 UTC
   Universal time: Wed 2020-05-0619:33:20 UTC
     RTC time: Wed 2020-05-0619:33:22    
    Time zone:UTC(UTC,+0000)           
System clock synchronized: yes                         
    NTP service: active                      
   RTC in local TZ: no   

The system time zone is configured through the link file /etc/localtime, which points to a binary time zone identification file in the /usr/share/zoneinfo directory. Another way to check the time zone is to display the actual path the linked file points to, using the ls command:

ls -l /etc/localtime
lrwxrwxrwx 1 root root 27 Dec 1012:59/etc/localtime ->/usr/share/zoneinfo/Etc/UTC

The time zone of the system is also written into the /etc/timezone file:

cat /etc/timezone
UTC

Three, use the timedatectl command to modify the time zone##

When changing the time zone, you will need to find a long name for the time zone you want to use. The time zone usually uses the "region/city" format.

To list all available time zones, you can list all files in the /usr/share/zoneinfo directory, or run the timedatectl command with the list-timezones option:

timedatectl list-timezones
...
America/Montevideo
America/Nassau
America/New_York
America/Nipigon
America/Nome
America/Noronha
...

Once you have identified which time zone is ready to describe your location, as root or another user with sudo privileges, run the following command:

sudo timedatectl set-timezone your_time_zone

For example, if you want to set the system time zone to America/New_York:

sudo timedatectl set-timezone America/New_York

Run the timedatectl command to verify the modification:

timedatectl
    Local time: Wed 2020-05-0615:41:42 EDT  
   Universal time: Wed 2020-05-0619:41:42 UTC  
     RTC time: Wed 2020-05-0619:41:48      
    Time zone: America/New_York(EDT,-0400)
System clock synchronized: yes                         
    NTP service: active                      
   RTC in local TZ: no   

Fourth, use the GUI to modify the time zone##

If you are running Ubuntu desktop version, you can also modify the current system time zone through the GUI.

  1. Click on the system icon to open the system settings window, as shown below:

  1. In the system settings window, click the Date & Time tab. If Automatic Time Zone is turned on, and you have an Internet connection and location services are also turned on, then your time zone should have been automatically set according to your location.

  2. To select a new time zone, you need to click on the map or search for a time zone through the search bar.

Once done, click on the x to close the window.

Five, summary##

We have shown you how to change the time zone of your Ubuntu system.

Original: https://linuxize.com/post/how-to-set-or-change-timezone-on-ubuntu-20-04/

 Copyright notice: This work uses Creative Commons attribution-Share 4 in the same way.0 International license agreement for licensing.

Recommended Posts

How to set or modify the time zone on Ubuntu 20.04
How to set or modify the time zone on Ubuntu 20.04
How to set or modify the time zone in CentOS 8
How to modify the hostname on Ubuntu 20.04
How to modify time zone and time in ubuntu
How to set up time synchronization on Ubuntu 18.04
How to set time zone and NTP synchronization on Ubuntu 14.04 [Quick Start]
How to modify time zone and time in ubuntu system
How to set up Gogs on Ubuntu 14.04
How to set up R on Ubuntu 14.04
How to set PostgreSQL startup on Ubuntu 16.04
How to modify the hostname on CentOS 8
How to set up Shiny Server on Ubuntu 14.04
How to set static IP on Ubuntu 18.04 Server
How to set static IP on Ubuntu 18.04 Server
Explain how to set static IP on ubuntu14.04
How to modify the CentOS server time to Beijing time
How to run the parsing server on Ubuntu 14.04
How to check the installed JDK on Ubuntu
How to install the latest MySQL on Ubuntu 18.04
How to set a fixed IP based on Ubuntu 16.04
How to install Ruby on Ubuntu 20.04
How to install Memcached on Ubuntu 20.04
How to install Java on Ubuntu 20.04
How to install MySQL on Ubuntu 20.04
How to install VirtualBox on Ubuntu 20.04
How to install Elasticsearch on Ubuntu 20.04
How to install Nginx on Ubuntu 20.04
How to install Apache on Ubuntu 20.04
How to install Git on Ubuntu 20.04
How to install Node.js on Ubuntu 16.04
How to install MySQL on Ubuntu 20.04
How to set up Java Home on Ubuntu and Raspbian
How to install Vagrant on Ubuntu 20.04
How to install PostgreSQL on Ubuntu 16.04
How to install Git on Ubuntu 20.04
How to set up a Masterless Puppet environment on Ubuntu 14.04
How to install Memcached on Ubuntu 18.04
How to install Jenkins on Ubuntu 16.04
How to install MemSQL on Ubuntu 14.04
How to set up a firewall with UFW on Ubuntu 14.04
How to install Go on Ubuntu 20.04
How to install MongoDB on Ubuntu 16.04
How to install Mailpile on Ubuntu 14.04
How to install PrestaShop on Ubuntu 16.04
How to upgrade to PHP 7 on Ubuntu 14.04
How to install Skype on Ubuntu 20.04
How to install Jenkins on Ubuntu 20.04
How to install Python 3.8 on Ubuntu 18.04
How to install KVM on Ubuntu 18.04
How to set up vsftpd for anonymous downloads on Ubuntu 16.04
How to install KVM on Ubuntu 20.04
How to install opencv3.0.0 on ubuntu14.04
How to install Anaconda on Ubuntu 20.04
How to install Prometheus on Ubuntu 16.04
How to install Jenkins on Ubuntu 18.04
How to deploy Django on Ubuntu 14.04
How to install Apache on Ubuntu 20.04
How to install R on Ubuntu 20.04
How to set up a production Elasticsearch cluster on Ubuntu 14.04
How to set up an Apache virtual host on Ubuntu 16.04