How to set Date and Time on a Linux Server
Linux Display Current Date and Time
Type the date command:$ date
Sample outputs:
Tue Oct 4 13:11:27 IST
2022
Linux Display The Hardware Clock (RTC)
Type the following hwclock command to read the Hardware Clock and display the time on screen:# hwclock -r
OR show it in Coordinated Universal time (UTC):
# hwclock --show --utc
Linux Set Date Command Example
date --set="STRING"
For example, set new data to 2 Oct 2006 18:00:00, type the following command as root user:
# date -s "4 OCT 2022 18:00:00"
Type the following timedatectl command:
$ timedatectl
sudo timedatectl set-time YYYY-MM-DD
For example set the current date to 2022-10-04 (4th, Oct, 2022):
# timedatectl set-time '2022-10-04'
# timedatectl
[root@shsdascn7i ~]# date -s "4 OCT 2022 13:12:00"
Tue Oct 4 13:12:00
IST 2022
Comments
Post a Comment