How to manually change linux system time?

by ari.olson , in category: General Help , a month ago

How to manually change linux system time?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer


by anissa , a month ago


To manually change the system time in Linux, you can follow these steps:

  1. Open a terminal.
  2. Check the current date and time using the date command: date
  3. To change the system time, you'll need root privileges, so switch to the root user or use the sudo command before the following steps: sudo su
  4. Set the system date and time using the date command in the following format: date +%Y%m%d -s "20220101" # Setting the date to January 1, 2022 date +%T -s "09:30:00" # Setting the time to 9:30:00 Replace "20220101" and "09:30:00" with the desired date and time values respectively. Note that the time format is 24-hour clock.
  5. After setting the date and time, synchronize the hardware clock with the system time using the hwclock --systohc command: hwclock --systohc

After these steps, the system time should be changed. You can verify the changes by running the date command again.