How to change the Universal time in Linux?

To change the Universal time of a Linux system, you can utilize the command line tool timedatectl.

Here are the steps for adjusting the Universal time:

  1. Open the terminal and login as the root user or a user with sudo permissions.
  2. Use the following command to view the current Coordinated Universal Time and time zone:
timedatectl
  1. Modify the Universal Time using the following command:
timedatectl set-time "YYYY-MM-DD HH:MM:SS"

The format YYYY-MM-DD represents the date, while HH:MM:SS represents the time.

  1. Use the following command to change the time zone:
timedatectl set-timezone "时区"

For example, to change the time zone to Asia/Shanghai:

timedatectl set-timezone Asia/Shanghai
  1. Use the following command to verify the changes:
timedatectl

Confirm that the Universal time and time zone have been successfully updated.

Please note that modifying Universal Time may require root or sudo privileges.

bannerAds