Show Date And Time In The Terminal

Today’s article is a nice and easy one, where I show you how to show the date and time in the terminal. It seems like a nice and easy article to write when I’m not feeling well. I’ll try to not let my ailments hamper the article in any way. 

Normally, I’d have a few articles written ahead of time. This time, I only have one article written ahead of time and it’s my ’emergency’ article. I’m not doing that poorly, so I’ll write this one. I’m pretty dedicated to doing an article every other day.

Anyhow, as I said, this article will show you how to get the date and time from the terminal. You can actually get the time just from running uptime, but there’s more to it. Linux actually has a ‘date’ command, which is what we’ll be using for this exercise. The date command’s man page describes it like:

date – print or set the system date and time

We will only be using the date command to print the time in the terminal. There are easier ways to set and maintain the time. With NTP being common, you really shouldn’t have to worry much about keeping the time accurate enough on your system.

Why would you want to know the date and time? Not everyone uses a desktop environment with a GUI and a clock. You may need to know the system time when you’re working on it remotely. There are all sorts of reasons. In fact, I once wrote an entire article about finding your timezone in Linux.

Show Date And Time In The Terminal:

This article requires an open terminal, just like many other articles on this site. Just press CTRL + ALT + T and your default terminal should open.

Now, this is nice and obvious… With your terminal open, just type in:

You’ll get an output similar to this one:

Tada! You’re done!

Just kidding! There’s more to it. If you want to show just the time, you can just use this command:

If you want to show the date and have it formatted like we do in the US, you can use this command:

Want to know the date 3 weeks ago? (You can also use days for this command)? Well then, you can try this command:

How about if you want to know how many days into the year you are? Well, you can do that with:

Those are about the most interesting ways to show the date and time in the terminal, at least the most interesting ways that I can think of at this moment in time. If you use the date command for anything else, let us know by leaving a comment!

Closure:

There you have it, yet another article! This one shows you how to show the date and time in the terminal, just in case you want to do that. It’s a nice and easy exercise and, as far as tools go, is one that’s at least easy to remember. It’s probably not the most important tool you can have in your toolbox, but at least it’s in there. (Please be gentle pointing out any errors, part of this article was written with the help of a heating pad.)

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Subscribe to Newsletter!
Get notified when new articles are published!
We promise to never share your email!
icon

Author: KGIII

Retired mathematician, residing in the mountains of Maine. I may be old and wise, but I am not infallible. Please point out any errors. And, as always, thanks again for reading.

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter
Get notified when new articles are published! It's free and I won't send you any spam.
Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.