How To: Find Out When A File Was Created

Today, we’re going to learn how to find out when a file was created. Odds are good that you could use the right click menu in a GUI file manager and figure it out, or you can sort by time and show details, that sort of stuff. Those being ‘easy’ we’ll learn how to find out when a file was created in the terminal.

Yeah, a lot of these articles explain how to do things in a terminal – even when there’s a nice graphical way to accomplish those same things. While it’s true that we may have different shells, we’re far more universal in the terminal than we are in a graphical desktop environment.

It’s good to learn how to do things in the terminal. If you can accomplish your goal in the terminal – you can accomplish it quickly and easily everywhere. That’s a pretty great benefit. (It’s not even unique to Linux – as you can do a whole lot via command line in Windows and MacOS.)

Also, today’s article feels a bit like work. I was hoping that it’d take longer to really start feeling that way. It’s okay. I picked a brief subject, what should be a short article, and that’ll be almost like a day off.

Find Out When A File Was Created:

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

With your terminal open, change to the directory that contains the file you want to find out when it was created. Let’s say it’s in your Documents directory:

Now, you can just use the -l flag with the ls command. That’d look like this –  showing the creation date (and maybe time, if the file is recent enough) for all the files in that directory:

That’s pretty messy, especially if you have a lot of files in the directory. So, you can specify the file for which you want to find the creation date by specifying the filename in the command itself, like so:

That’ll do it for you. Well, it should do it for you! If not, something’s broken and don’t ask me to fix it!

Closure:

There you have it… You can now tell when a file was created. It’s not a very difficult process and it’s one you can easily commit to memory. I find myself using it when I’ve created a file and then can’t find it among other files with similar names – I’ll check to wee when a file was created and figure it out that way.

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.

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 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.