Here are the two ways to set a date and time on Rocky Linux 8 or AlmaLinux using the command terminal and graphical user interface.
There are many processes on the Linux operating system that requires the correct system date and time. Also, to update the system properly and other processes like cronjobs we must need the up-to-date time & date. However, Linux or any other OS automatically syncs the system time from the server, in case not or you want to change the timezone manually then let’s explore how to do that.
Use GUI to set time and date in Rocky Linux 8
Step 1: Go to your default Rocky Linux Gnome GUI, select the drop-notch icon given on the right top side to open the menu. From there click on the Settings icon. If you are using some other Desktop interface then can open Settings from the Application launcher.
Step 2: Under Settings either search for Date and time or simply go to Devices and then select Time and Date.
Step 3: If Automatic Date & Time has been enabled and you want to set it manually. Then first turn it off. Or simply disable and enable it to sync the system clock.
Step 4: However, for those who want to set manually the clock after turning Automatic updating off, the grey “Date & Time” settings will appear to change manually. Select it.
Step 5: Enter the Time and the date you want to have on your Rocky Linux system. In the same way, you can also update the Time zone manually.
Step 6: Well, if you think the Automatic Date & Time is working fine, then enable the toggle the “Automatic Time Zone” button to update the same using the internet access.
Update Date & Time zone on command terminal on Rocky Linux
To check the time and date on the command terminal
timedatectl status or timedatectl
To get the list of available Time-zones and change it, run:
Whereas to select some particular timezone:
timedatectl set-timezone select-the-time-zone
timedatectl set-timezone Africa/Cairo
For changing the Time on Rocky Linux manually run:
To change the time or date, first, we have to manually disable the NTP – Network Time Protocol that is handled by Chrony on Rocky Linux or AlmaLinux even on CentOS 8. Hence, to manually update the time, first stop this service:
sudo systemctl stop chronyd
# now chnage time timedatectl set-time enter-the-time
timedatectl set-time 02:10:00
To change Date use the following command syntax
timedatectl set-time date
timedatectl set-time 2021-11-11
If you want to update both time and date using the command line at once, use the following syntax.
timedatectl set-time ‘2021-10-11 12:15:25’