Setting the time and date in linux

To set the date and time in linux you will need to use the following command:
date 092011082001.30

This will set the time/date to: Thu Sep 20 11:08:30 2001

The format for the above command is:

date <month><day><hour><minute><year>.<seconds>

You will need to save the new time/date to the hardware clock so the changes are kept when you reboot, to do this use the following command:

hwclock --systohc --utc

The '--utc' switch is normally used as most linux systems have their hardware clocks set to UTC not localtime. If you have MS Windows on the same system omit this switch.

Last updated: 25/06/2005