Where to start First steps track · 15 stages
Linux Labs

date — date and time in the shell

cheat sheet · GNU coreutils https://lab.dimsanych.ru/en/wiki/date/

Cheat sheet

  • date +%F 2026-06-30 (=%Y-%m-%d)
  • date +%Y%m%d-%H%M%S a timestamp for filenames
  • date +%s epoch: seconds since 1970
  • date -d @1700000000 epoch → human-readable
  • date -d "yesterday" +%F yesterday
  • date -d "now + 1 hour" +%T an hour from now
  • TZ='UTC' date current time in another timezone
  • date -Iseconds ISO 8601
  • tar czf "bk-$(date +%F).tgz" /etc a date in a backup's name

Options

Below are the main flags of date; the full list is in man date (the +%… format specifiers are a separate topic, see the table under "Recipes").

Loading…