Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

timedatectl

Show and change the system time, the time zone, the RTC mode and whether NTP sync is on.

Niveau
RHCSA-examen
Groep
Tijd
Root nodig
Voor wijzigingen
Pakket
systemd

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

Without arguments timedatectl shows local time, UTC, RTC time, time zone, whether the clock is synchronized and whether the NTP service (chronyd) is active. Subcommands change these settings.

Zo schrijf je het

timedatectl [OPTION]... [COMMAND]

Belangrijkste delen

status
Show the settings (default).
show
Settings as key=value (for scripts).
set-time "YYYY-MM-DD HH:MM:SS"
Set the clock (NTP must be off).
set-timezone ZONE
Set the time zone.
list-timezones
All zone names.
set-local-rtc 0|1
RTC in UTC (0) or local time (1).
set-ntp true|false
Turn NTP sync (chronyd) on or off.
timesync-status, show-timesync, ntp-servers, revert
For systemd-timesyncd (not used by default on RHEL).

Opties 11

Meest gebruikt

--adjust-system-clock
With set-local-rtc: also set the system clock from the RTC.
-p, --property=NAME
With show: only these properties.
-a, --all
With show: all properties.
--value
With show: only the values.
--monitor
With timesync-status: keep updating.
--no-ask-password
No password questions.
--no-pager
Do not use a pager.
-H, --host=HOST
Remote host over SSH.
-M, --machine=NAME
A container.
-h, --help
Show help.
--version
Show the version.

Voorbeelden 10

$ als gewone gebruiker# als root (of met sudo)

  1. 1Show all settings

    timedatectl
                   Local time: Sun 2026-10-25 11:42:10 +03
               Universal time: Sun 2026-10-25 08:42:10 UTC
                     RTC time: Sun 2026-10-25 08:42:10
                    Time zone: Asia/Riyadh (+03, +0300)
    System clock synchronized: yes
                  NTP service: active
              RTC in local TZ: no

    Everything at once.

  2. 2Set the time zone

    timedatectl set-timezone Asia/Riyadh

    Changes the /etc/localtime link.

  3. 3Find a zone name

    timedatectl list-timezones | grep -i amsterdam
    Europe/Amsterdam

    Exact names are needed.

  4. 4Turn NTP on

    timedatectl set-ntp true

    Starts and enables chronyd.

  5. 5Set the time by hand

    timedatectl set-ntp false
    timedatectl set-time "2026-10-25 12:00:00"

    Only for labs without a time server.

  6. 6RTC in UTC

    timedatectl set-local-rtc 0

    Recommended for servers.

  7. 7Value for a script

    timedatectl show -p NTPSynchronized --value
    yes

    Monitoring check.

  8. 8Check many servers

    for h in server1 server2; do ssh $h timedatectl show -p Timezone --value; done

    Same zone everywhere?

  9. 9Time zone link

    ls -l /etc/localtime
    lrwxrwxrwx. 1 root root 33 Oct 25 11:40 /etc/localtime -> ../usr/share/zoneinfo/Asia/Riyadh

    What set-timezone changed.

  10. 10Unsynced clock alert (security)

    [ "$(timedatectl show -p NTPSynchronized --value)" = yes ] || echo "clock not synced"

    Wrong time breaks TLS, Kerberos and log analysis.

Exitcodes

0Done.
1Error.