Checking/resetting the date/time

February 22nd, 2005

To check whether the date/time is correct on your Linux machine, enter the command:

date

And compare the results with the output of the command:

rdate -p <server>

where server is one of the following:

table.bespoke {
border: 1px hidden #342DAC;
border-collapse: collapse;
background-color: #F3FEFF;
}
table.bespoke th {
border: 1px outset #342DAC;
background-color: #FFFFF0;
}
table.bespoke td {
border: 1px outset #342DAC;
padding: 2px;
}
table.bespoke .country {
text-align: center;
}

Server Country
ntp.demon.co.uk UK
nist1.datum.com US
time-b.nist.gov US
time.nist.gov US
utcnist.colorado.edu US
mizbeaver.udel.edu US

For example:

# date
Tue Feb 22 08:55:06 GMT 2005
# rdate -p ntp.demon.co.uk
rdate: [ntp.demon.co.uk]        Tue Feb 22 08:50:14 2005

In the above example, the local machine is about 5 minutes fast.

rdate -p <server>

prints the date from the remote server.

To set your Linux machine to that date, use:

rdate -s <server>

For example:

rdate -s ntp.demon.co.uk

You can use ntpd to check and set your time on a regular basis, but if keeping accurate time isn't critical for you, the occasional manual check and reset is all you need.

For more information, see: http://linuxreviews.org/howtos/ntp/

Leave a comment