date

Display or set the system date and time; format timestamps.

low risk

interactive breakdown — edit the command and press Explain
$ 
⚠ Risks & cautions
What it does

date displays the current date/time in configurable formats, or sets the system clock. Heavily used in scripts for generating timestamps, log filenames, and date arithmetic. The -d flag parses arbitrary date expressions.

Common flags
FlagMeaning
-d --dateDisplay the given date string
-u --utcUse UTC time
+FORMATCustom output format
Examples
date '+%Y-%m-%d_%H:%M:%S'ISO-style timestamp for log filenames · explain & risk-check →
date -u +%sUnix epoch seconds in UTC · explain & risk-check →
date -d 'yesterday' '+%Y-%m-%d'Yesterday's date for log rotation scripts · explain & risk-check →
date -d '7 days ago' '+%Y-%m-%d'Date 7 days ago · explain & risk-check →
date -d @1700000000Convert Unix timestamp to human-readable · explain & risk-check →
Pro tip

Use `date +%s` and arithmetic for measuring script execution time: `start=$(date +%s); ... ; echo $(($(date +%s)-start))s elapsed`

Related
timedatectl crontab watch
Open the full explainer →More in System & Processes

Reference text is hand-written and may be incomplete — check man date for your version. Test destructive commands on a non-production system first.