Setting the Date and Time in Linux
Updated October 10, 2002
Created September 27, 2000


Autogenerated Site Map
Search this Site!:
Search this site powered by FreeFind

You have at least 2 methods for setting the date and time in Linux:
  1. You can set the time by hand, but be careful, lots of clocks tend to drift over time. The trick here to make the time stick across a reboot is to run the hwclock command as shown below

  2. You can use NTP (Network Time Protocol) to get accurate time from a network time server (Atomic Clock). I highly recommend using NTP to keep your time set correctly: ntp.html
Note: Just using the date command alone will not cause the date to remain after a reboot. The date command sets the Linux system clock which is separate from the hardware clock. The "hwclock --utc --systohc" command is used to update the hardware clock with the date from the Linux system clock.

Run the date command to make sure you have the correct time:


[root@server /root]# date
Thu Sep 20 11:00:06 CDT 2001
[root@server /root]# 

If you have the wrong timezone set, use "timeconfig" or "linuxconf" to set the correct timezone.

If your timezone is correct but the date and/or time needs updating, the following commands will update the date and time. The second command is needed in order to push the date and time into the PC clock.


[root@server /root]# date 092011082001
Thu Sep 20 11:08:00 CDT 2001
[root@server /root]# hwclock --utc --systohc
[root@server /root]# 

Search this Site!:
Search this site powered by FreeFind

Homepage: http://www.cpqlinux.com
Site Map: http://www.cpqlinux.com/sitemap.html