Ad space (banner)
🖥️Linux Lessons
Lesson 42 / 61

Checking the Current Date and Time with date

date is for when "I want to record the current date and time into a log file." date displays the current date and time, and is used frequently inside shell scripts too.

Just type date alone to run it. To change the display format, you can also pass a format specifier, like date "+%Y-%m-%d".

Running date prints a single line showing the current date and time, something like Thu Aug 13 2026 10:00:00 UTC.

A common early mistake is a server's timezone setting differing from what you expect, so the displayed time is confusingly off. On an internationalized server, checking the timezone matters.

In real work, this is used constantly inside shell scripts — including a date in a log filename, timestamping a backup file, and more.

Linux
Try it (type this into the pseudo terminal)
date

🧑‍💻 You can type this command into the Linux pseudo terminal to try it yourself (this page itself has no interactive terminal).

Ad space (banner)
Ad space (in-article)