Introduction
This lesson is about keeping the system clock correct and predictable.
The main question is:
How do you set the right date, time, timezone, and clock synchronization settings on a Linux system?
What you should be able to do after this lesson:
- Tell the difference between system time, hardware clock, and timezone.
- Check and change the current date and time.
- Understand why Linux systems usually keep the hardware clock in UTC.
- Use
timedatectl,date,hwclock,chronyc, and be aware ofntpdandntpq. - Recognize the role of
pool.ntp.org.
Big Idea: Linux Tracks Time in More Than One Place
Beginners often think there is only one clock. In practice, Linux works with a few related pieces:
- the system clock used by the running kernel
- the hardware clock stored in the machine's RTC chip
- the timezone that decides how time is displayed for humans
- the time synchronization service that keeps the clock accurate
If you keep these roles separate, time problems become much easier to debug.
System Time vs Hardware Clock
System time
This is the clock the running system uses right now. Programs, logs, timers, and scheduled jobs depend on it.
Check it:
date
timedatectl
Hardware clock
This is the motherboard clock, sometimes called the RTC. It continues to run while the machine is powered off.
Check it:
sudo hwclock --show
Common rule on Linux:
- keep the hardware clock in
UTC - let the timezone setting control local display
That avoids many daylight saving and dual-boot problems.
Timezone
The timezone does not change the actual point in time. It changes how Linux shows that time to humans.
List available timezones:
timedatectl list-timezones | head
Show current timezone:
timedatectl
Set a timezone:
sudo timedatectl set-timezone Europe/Moscow
Behind the scenes, systems commonly use:
/usr/share/zoneinfo/
/etc/localtime
/etc/timezone
Setting Date and Time Manually
If you need to set time manually, you can use timedatectl or date.
Example with timedatectl:
sudo timedatectl set-time '2026-03-29 14:30:00'
Example with date:
sudo date --set='2026-03-29 14:30:00'
Manual changes are useful for labs and troubleshooting, but on normal systems you usually want automatic synchronization.
Synchronizing Time with NTP
Accurate time matters for:
- logs
- TLS certificates
- Kerberos and other authentication systems
- scheduled jobs
- cluster coordination
Two names you should know for LPIC:
ntpdchrony
In modern everyday Linux, chrony is very common.
Chrony
Check status:
chronyc tracking
chronyc sources
Common config file:
/etc/chrony.conf
NTP daemon
Common config file:
/etc/ntp.conf
Useful exam awareness:
ntpq -p
This shows known NTP peers and synchronization state.
pool.ntp.org
Many systems sync from public time servers through:
pool.ntp.org
You do not memorize a long server list. You just need to know it is a public pool used by many NTP setups.
timedatectl
On systemd-based systems, timedatectl is the fastest way to inspect time settings.
Useful examples:
timedatectl
timedatectl status
timedatectl set-ntp true
timedatectl set-timezone UTC
The status output helps you answer:
- Is NTP enabled?
- Is the timezone correct?
- Is the hardware clock treated as local time or UTC?
Hardware Clock and UTC
To copy system time into the hardware clock:
sudo hwclock --systohc
To copy hardware clock into system time:
sudo hwclock --hctosys
For Linux administration, the most important idea is:
- correct system time first
- use UTC in the hardware clock
- keep automatic sync enabled when possible
Practice Step by Step
1) Inspect current time settings
- Run:
date - Then run:
timedatectl - Notice the difference between:
- local time
- universal time
- RTC time
- timezone
2) Check the hardware clock
- Run:
sudo hwclock --show - Compare it with:
date - If they are very different, the system may have a time setup problem.
3) Change the timezone safely
- List a few zones:
timedatectl list-timezones | grep -E 'Europe|UTC' | head - Set one:
sudo timedatectl set-timezone UTC - Verify:
timedatectl - Change it back to your normal timezone if needed.
4) Check synchronization status
- Run:
timedatectl - If
chronyis installed, also run:chronyc trackingchronyc sources - Look for evidence that the clock is synchronized.
Cheat Sheet
date
timedatectl
sudo timedatectl set-timezone UTC
sudo timedatectl set-time '2026-03-29 14:30:00'
sudo hwclock --show
sudo hwclock --systohc
chronyc tracking
chronyc sources
ntpq -p
Legacy / Exam Note
LPIC still expects awareness of ntpd, ntpq, and even ntpdate.
In real systems today, chrony or systemd-timesyncd is often more common.
For the exam, know the older names too.
Test Your Knowledge
Complete the quiz to assess your understanding of this course's concepts.
