Skip Navigation
Site HomeSearch

On-Line Reference:
RedHat Linux Unleashed

Did this help?
... or
Donate at PayPal®...

Tux the Pengin

OK, here's a freebie: A simulation of the old text-based Star Trek game we used to play on HP 2100's using a Teletype ASR-33 as a console: StarTrek Game

Setting Your Linux System Clock


  1. man date
  2. Linux Planet


  1. How To Do It
  2. A Little Background

How To Do It

This is a quick and (not)dirty time setting procedure - if you want the long version see "Time for Linux" at Linux Planet.

If you are logged in as a user (which you should be), "su" to root and enter the following to set the current time:

# date -s "hh:mm:ss"

The time will be taken as 24-hour(military) time. Then type just the date command and see if it "took". Linux should respond with a full date and time.

Now, set the CMOS hardware clock to the system software current time:

# hwclock --systohc

A (Very) Little Background

"hwclock" is a command in /sbin. It accepts commands from the terminal, as you see above, and is called from a halt script in init.d when the system is shutdown, to copy the system time into the hardware clock.

Your system time zone and (if you live in the USA) "daylight savings" flag are used to restore the time on startup. Check that rhe zone is correct:

# date Sun Oct 28 08:45:47 PST 2001      ["PST" is the zone]

A list of zones available in your system can be found in /usr/share/zoneinfo/ . If your zone is not correct, you can append the correct zone to the time setting:

# date -s "hh:mm:sszzz"    [where "zzz" is the zone]
Print plain