Update System Time From Command Line in Ubuntu

In this tutorial, we will learn how to update the system time and time zone on Ubuntu Linux. This can be done from the command line terminal with the timedatectl command to synchronize your system’s time with official time servers.

Update System Time

To update the system time in Ubuntu, you can use the timedatectl command. This command allows us to configure the date and time zone in our system.

Example 1. To see the information of your time zone, along with the local and universal time:

$ timedatectl

Example 2. If you want to synchronize the system time with external time servers, use the command below:

$ sudo timedatectl set-ntp on

Example 3. Or, if you want to turn this synchronization off:

$ sudo timedatectl set-ntp off

Update System Time to a Specific Time Zone

Example 1. To show the list of all time zones, execute the next command:

$ timedatectl list-timezones

Example 2. If you want to show only results for a specific timezone, pipe to the grep command:

$ timedatectl list-timezones | grep US

Example 3. Now, you can set the time to the time zone you have chosen from the output:

$ sudo timedatectl set-timezone US/Eastern

Your system time will now be kept in sync with the time zone you have chosen. This works by querying official time servers upon system start and other intervals, and adjusting your computer’s clock accordingly.

Leave a Comment

Your email address will not be published. Required fields are marked *