Difference between revisions of "Linux datetime"

From Noah.org
Jump to navigationJump to search
Line 1: Line 1:
 
[[Category:Engineering]]
 
[[Category:Engineering]]
== Set your clock and timezone ==
+
== Set timezone and clock on Linux ==
 +
 
 
1. su to root
 
1. su to root
  
Line 15: Line 16:
  
 
5. Use rdate or ntpdate to set the system time (ntpdate is better):
 
5. Use rdate or ntpdate to set the system time (ntpdate is better):
 +
    /usr/sbin/ntpdate time.nist.gov
 +
or
 
     /usr/bin/rdate time.nist.gov
 
     /usr/bin/rdate time.nist.gov
or
 
    /usr/sbin/ntpdate time.nist.gov
 
  
 
6. Set the hardware clock to the system time:
 
6. Set the hardware clock to the system time:
 
     /sbin/hwclock --systohc
 
     /sbin/hwclock --systohc

Revision as of 10:33, 23 June 2007

Set timezone and clock on Linux

1. su to root

2. Find your timezone file under /usr/share/zoneinfo. For example:

   /usr/share/zoneinfo/US/Pacific

3. OPTIONAL: backup the current timezone configuration:

   cp /etc/localtime /etc/localtime.old

4. Create a symbolic link from the appropiate timezone to /etc/localtime.

   ln -sf /usr/share/zoneinfo/US/Pacific /etc/localtime

or

   ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime

5. Use rdate or ntpdate to set the system time (ntpdate is better):

   /usr/sbin/ntpdate time.nist.gov

or

   /usr/bin/rdate time.nist.gov

6. Set the hardware clock to the system time:

   /sbin/hwclock --systohc