How To Set Date, Time And Timezone In Ubuntu 20.04 LTS?
 

How To Set Date, Time And Timezone In Ubuntu 20.04 LTS?

 

Ubuntu is among the most popular Linux distributions, which is developed by Canonical. It is easy to use, easy to install, and includes mostly free and opensource softwares.

Most of the systems installed Ubuntu detects and synchronizes time automatically. However, you may find that your system is not synchronizing properly in this case you can set date time or timezone manually.

So in this article, we will set date, time, and timezone manually using a terminal in Ubuntu 20.04 LTS.

How to display the current date and time

To display the current date and time you can use the following command in your terminal –

date

or also you can use –

timedatectl

Most of the modern systems based on systemd use a utility called timedatectl to set or display the date and time of a system.

How to change the current date and time using the date command

To change the current date, use the following command –

sudo date +%Y%m%d -s "20200820"

This command will set the current date to 20 Aug 2020.

Change time using the command line –

sudo date +%T -s "09:28:00"

If you want to change both date and time then you should use the date command in the given format –

sudo date -s "20 AUG 2020 09:28:00 PM"

How to change the current date and time using timedatectl

By using timedatectl command you can set or display the current date, time and timezone, etc of a system.

To set time we will use set-time with timedatectl command –

timedatectl set-time 09:03:10

If you want to modify the system date only then use –

timedatectl set-time 20200821

The date is passed in the YYYYMMDD format in the command given above.

You can use the following command to set date and time using a single command –

timedatectl set-time '2020-08-21 09:03:10'

How to change the timezone

To see the list of available timezones use the following command –

timedatectl list-timezones

This will display the list of timezones you can scroll and choose the appropriate one.

Now to set timezone use the following command –

timedatectl set-timezone 'Your_time_zone'

For example, my timezone is Asia/Kolkata so I will use –

timedatectl set-timezone 'Asia/Kolkata'

As you can see in the image above the time zone is now changed to Asia/Kolkata(IST, +0530).

Synchronizing the system clock with a remote NTP server

Instead of setting the time manually using the date or timedatectl command you can synchronize the system clock with the remote NTP server. NTP or Network Time Protocol is an internet protocol that is used to synchronize time between computers.

Please note you should have NTP installed in your system to start automatic time synchronization using NTP servers.

Now use the following command in your terminal –

timedatectl set-ntp true

As you can see in the image above, the system clock is now synchronized and NTP services are active now. The system will now automatically update the system date and time.

If you want to disable NTP services use –

timedatectl set-ntp false

Conclusion

By reading this you can now change the date, time, and timezone in a system. Also, you can start NTP services to start time synchronization automatically. Now still if you have a query you can write us in the comments below.

Previous [xfce] How to enable automatic login on xrdp
Next [xfce] can't use the store or synaptic
 

About author

You might also like

Linux Terminal 0 Comments

What Is A Virtual Terminal In Linux/Unix?

This post was last updated on August 1st, 2020 at 02:24 pmA virtual terminal or virtual console is a feature of Unix based system that allows multiple users to access

Linux Terminal 0 Comments

How To Install And Use Tcsh In Ubuntu?

This post was last updated on August 1st, 2020 at 02:47 pmTcsh or TENEX c shell is a Unix shell similar to other shells such as bash, ksh, zsh, etc.

Linux Terminal 0 Comments

How To Change Username In Linux/Unix From The Terminal?

This post was last updated on August 1st, 2020 at 03:04 pmIn a Linux/Unix system sometimes you may need to change the username or User ID (UID) of a user

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply