How to set the Linux clock
This is a quick time setting procedure
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
“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.
A list of zones available in your system can be found in /usr/share/zoneinfo/zone.tab . 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
How useful was this post?
Click on a star to rate it!
Average rating / 5. Vote count:
No votes so far! Be the first to rate this post.