date
SafeShow and compute dates
date '+%Y-%m-%d %H:%M:%S'
Formats dates; -d computes expressions like '3 days ago' — essential for log names and batch windows.
Examples
date -d '7 days ago' +%Y%m%dThe date a week ago
Syntax
date ['+format'] [-d 'expr'] [-u]
Before you run it
Read only (set time via timedatectl).
Related commands
- timedatectlShow/set time & NTP
- findFind files
The same reference, with no signal at all
Every command on this site, held on your device. The app adds 632 more: 1,510 commands and 120 fix flows, searchable with no connection. Free to install, no ads (some content is a one-time purchase).
Get it free on the App Store