The date command
The date command prints the current date and time.
Taught in Intermediate, lesson 24; more in Advanced
A practice shell in your browser that behaves like bash on Linux for these commands. Nothing you type leaves the page.
Usage
date date +FORMAT
Print the date and time. Prints the current date and time, or with +FORMAT, just the parts you ask for: %Y is the year, %m the month, %d the day, %H:%M:%S the time, %F the whole date as 2026-01-12 and %T the time as 09:30:00. The practice shell runs on its own clock, which starts on 12 January 2026 and ticks a minute for every command.
How to use date
Print the date and time
The practice shell keeps its own clock: it starts on 12 January 2026 and ticks a minute for every command.
dateMon Jan 12 09:01:00 UTC 2026
Options
| +FORMAT | print the date this way: %F, %T, %Y, %m, %d, %H, %M, %S, %a (Mon), %b (Jan), %s (seconds since 1970) |
|---|
More examples
date +%F2026-01-12
date "+%d %b %Y, %H:%M"12 Jan 2026, 09:01
Questions about date
How do I print the date in another format?
Give a format after a +, as in date +%Y-%m-%d for 2026-01-12. The practice shell prints only the default format.
Learn it step by step
Related commands
Every everyday command on one page, to print or keep open: the Linux commands cheat sheet.