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

date

Show the date and time in any format, calculate other dates, or set the system clock.

المستوى
امتحان RHCSA
المجموعة
الوقت
يحتاج root
للتغييرات
الحزمة
coreutils

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

ماذا يفعل

date prints the current time in your time zone. +FORMAT controls the output (%F = 2026-10-25), -d shows another moment ("tomorrow", "+3 days", "@EPOCH"), -u uses UTC. root can set the clock with -s, but on a system with NTP chrony will correct it — use timedatectl and chrony instead.

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

date [OPTION]... [+FORMAT]
date [-u] -s "DATE TIME"

الأجزاء الرئيسية

%F
Date: 2026-10-25.
%T
Time: 11:42:10.
%Y %m %d
Year, month, day.
%H %M %S
Hour, minute, second.
%s
Seconds since 1970-01-01 UTC (epoch).
%a %A / %b %B
Short/long day name / month name.
%j
Day of the year.
%u
Day of the week (1 = Monday).
%V
ISO week number.
%z %Z
Time zone offset / name.
%N
Nanoseconds.

الخيارات 12

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

-d, --date=STRING
Show this moment instead of now: "yesterday", "+2 hours", "next monday", "@1761389000".
-u, --utc, --universal
Use UTC.
-s, --set=STRING
Set the clock (root).
-I[FMT], --iso-8601[=FMT]
ISO 8601 output (date, hours, minutes, seconds, ns).
--rfc-3339=FMT
RFC 3339 output (date, seconds, ns).
-R, --rfc-email
RFC 5322 (mail) format.
-r, --reference=FILE
Show the change time of a file.
-f, --file=FILE
Like -d for each line of a file.
--debug
Show how the date string was understood.
--resolution
Show the time resolution.
--help
Show help.
--version
Show the version.

أمثلة 11

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

  1. 1Now

    date
    Sun Oct 25 11:42:10 +03 2026

    Local time zone.

  2. 2A file-name friendly stamp

    tar -czf /backup/etc-$(date +%F_%H%M).tgz /etc

    etc-2026-10-25_1142.tgz.

  3. 3UTC

    date -u

    Same moment in UTC (logs from many servers).

  4. 4Calculate dates

    date -d '+30 days' +%F
    date -d 'last friday' +%F

    Expiry dates for chage -E.

  5. 5Epoch seconds

    date +%s
    1761381730
    date -d @1761381730

    Convert log time stamps.

  6. 6ISO format

    date -Iseconds
    2026-10-25T11:42:10+03:00

    For JSON and APIs.

  7. 7Time of a file change

    date -r /etc/passwd

    When was a user changed?

  8. 8Time in another zone

    TZ=Europe/Amsterdam date

    Without changing the system.

  9. 9Set the clock (lab without NTP)

    timedatectl set-ntp false; date -s "2026-10-25 12:00:00"

    With NTP on, chrony corrects it.

  10. 10Days until a certificate expires (security)

    echo $(( ( $(date -d "$(openssl x509 -enddate -noout -in /etc/pki/tls/certs/site.crt | cut -d= -f2)" +%s) - $(date +%s) ) / 86400 ))

    Alert when it gets low.

  11. 11Measure how long something takes

    S=$(date +%s); sleep 2; echo "took $(( $(date +%s) - S )) s"

    Simple timing in scripts.

رموز الخروج

0Done.
1Error.

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

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

في الطرفية: man date