الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

hwclock

Read or set the hardware clock (RTC), and copy the time between the hardware clock and the system clock.

المستوى
امتحان RHCSA
المجموعة
الوقت
يحتاج root
نعم
الحزمة
util-linux

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

ماذا يفعل

The hardware clock keeps time when the machine is off. At boot the kernel sets the system clock from it. hwclock shows it, --systohc writes the system time into it, --hctosys the other way. On RHEL chronyd keeps the RTC in sync (rtcsync), so you rarely need it.

طريقة الكتابة

hwclock [FUNCTION] [OPTION]...

الخيارات 22

الأكثر استخدامًا

Functions

-r, --show
Show the hardware clock time (default).
--get
Show the time with drift correction.
-w, --systohc
Set the hardware clock from the system clock.
-s, --hctosys
Set the system clock from the hardware clock.
--set --date=DATE
Set the hardware clock to DATE.
--systz
Reset the system time based on the time zone (boot scripts).
-a, --adjust
Correct the hardware clock for drift.
--predict --date=DATE
Predict the RTC value at DATE.
--param-get=PARAM, --param-set=PARAM=VALUE
Read or set RTC parameters.

Options

-u, --utc
The hardware clock is in UTC.
-l, --localtime
The hardware clock is in local time.
--date=DATE
Date for --set and --predict.
--update-drift
Recalculate the drift factor.
--noadjfile
Do not use /etc/adjtime.
--adjfile=FILE
Another adjtime file.
-f, --rtc=FILE
Another RTC device (default /dev/rtc0).
--delay=SECONDS
Delay for setting the RTC.
--directisa
Direct ISA access (old hardware).
--test
Do everything except change the clock.
-v, --verbose
Verbose.
-h, --help
Show help.
-V, --version
Show the version.

أمثلة 10

$ مستخدم عادي# بصلاحية root (أو مع sudo)

  1. 1Show the hardware clock

    hwclock
    2026-10-25 11:42:10.123456+03:00

    Shown in local time.

  2. 2Write the system time to the RTC

    hwclock --systohc

    After you set the time by hand.

  3. 3Set the system time from the RTC

    hwclock --hctosys

    Rarely needed (boot does it).

  4. 4Is the RTC in UTC?

    grep -E 'UTC|LOCAL' /etc/adjtime
    UTC

    Linux servers should use UTC.

  5. 5Compare both clocks

    hwclock; date

    A big difference = RTC battery or sync problem.

  6. 6Set the RTC to a date

    hwclock --set --date="2026-10-25 12:00:00"

    Test only.

  7. 7Dry run

    hwclock --systohc --test

    Shows what would happen.

  8. 8Same data in timedatectl

    timedatectl | grep RTC

    RTC time and RTC in local TZ.

  9. 9Dual boot with Windows

    timedatectl set-local-rtc 1

    Windows uses local time in the RTC; avoid on servers.

  10. 10Check chrony keeps the RTC in sync

    grep rtcsync /etc/chrony.conf
    rtcsync

    The kernel copies the time to the RTC every 11 minutes.

الملفات

/etc/adjtime
Drift data and UTC/LOCAL setting.
/dev/rtc0
The RTC device.

رموز الخروج

0Done.
1Error.

الدليل الكامل

هذه الصفحة تشرح الأمر بكلمات بسيطة. الدليل الأصلي فيه كل التفاصيل.

في الطرفية: man 8 hwclock