Find Files Created On A Specific Date

We sure do have a lot of file management articles and this is another one that will help you find files created on a specific date. This is a relatively easy task and you won’t even have to install anything new. If you want to find files created on a specific date, you might as well use this method!

Here’s a similar article.

Find Files Modified On A Specific Day

So, what is file management? To me, it’s manipulating files on your file system. It’s gathering information about the files on your file system. That’s what I mean when I say ‘file management’. I’ve covered a lot of articles with this as a subject.

Seriously… I tag articles with various terms. There are pages and pages of articles that have been tagged with file management.

Articles Tagged With File Management

Yup, that’s a lot of articles. Managing your files is something you do on a daily basis. You’re creating, editing, and moving your files around your file system. That’s file management and that’s okay!

Because this is something you do on a daily basis, even if you don’t pay attention to it, it’s something covered often. Even if you’re just browsing the internet, you’re adding files such as cached files. If you’re emailing with an email client, you have added and deleted files – if not more. File management is a pretty big thing.

Today, we’ll be using two basic commands – ls and grep. Let’s learn more!

The ls Command:

The ls command is an application that lets you list files. There are flags you can use, but it’s a basic application that, at its core, just lists files. You don’t need to install anything. You can verify that ls is available with this command:

The output should look like this:

Check the ls man page with this command:

If you do that, you’ll see that we’re on the right path if we want to find files created on a specific date. The ls command is briefly described as this:

ls – list directory contents

We’ll be using the ls command to output a list of files and we’ll then use the pipe operator to process that output with grep.

The grep Command:

The grep command is one of those commands that’s used in conjunction with another command. By itself, it’s not that useful. It is when you use grep with other commands that you realize how powerful it is.

The grep command is usually used with the | “pipe” operator. The pipe operator takes the output from one command and processes it with another application. I’ve not yet covered this in an article, nor have  I done an article about the grep command. I should do both.

Again, you won’t need to install anything. You can verify this with this command:

The output should match this:

Next, you can check the man page with this command:

grep, egrep, fgrep, rgrep – print lines that match patterns

You can see that there are options. We’ll be using just plain grep. And, as you can deduce, this is yet another process that will help us find files created on a specific date. We’ll take the output from one command and use it with the grep command. This should appear obvious shortly if you have not yet realized how we’ll be proceeding in this article.

Find Files Created On A Specific Date:

Both ls and grep are tools used in the terminal. As such, you can be sure that you’ll need an open terminal. Either open a terminal from your application menu or open a terminal by pressing CTRL + ALT + T on your keyboard. This article assumes that you don’t have year numbers in your file names, as you’ll see…

With your terminal open, we can begin to find files created on a specific date. Further, let’s stay right there in the ~/home/user directory. We’ll keep it simple.

Let’s start with this command:

That will list all your files. Now, let’s add hidden files – with the -a (all) flag with the following command:

Next up, let’s get more information from the ls command with the -l (long listing format) flag. That looks like this:

You should now see that there’s a time listed. We’re going through this just so that the example commands work. This isn’t strictly necessary, it’s just how it is being explained in this article.

If you want, you can sort that output by time. The following example command will show you the time the files were created, starting with the most recent example.

Again, that’s not strictly necessary.

Pay attention to the date section, because that’s what we’ll be using. 

More specifically, we’ll be piping the output from the ls command to the grep command. That’s done like this:

NOTE: You’ll be grepping a pattern. So, if you look carefully, the dates from 1 to 9 have two spaces! You’ll need to grep accordingly!

So, if you wanted to list articles created on the day this will be published, the command would look like this:

Notice that there are two spaces.

If you wanted to find files created on the 10th of February, your command would be different. You don’t add a 2nd space, as there is no second space in the pattern you’re looking for:

That will show you all the files (including the hidden files) that were created on the 10th of February. It does not care about the year and doesn’t show the year field. You’re simply finding files created on a specific date (ignoring the year, of course).

This is still useful.

This is also only true for files created within the past year. The ls command will happily show the date on files older than a year.

Here’s an example where the files are older than a year:

So, to find files including the year, your command now has more spaces to contend with. For this command, you would now add two spaces between the day and the year. Like so:

See the two spaces? That’s essential.

Again, don’t forget that you need two spaces when you’re working with days that are a single digit. If I wanted to find files from the 4th of November in 2022, that command would be this:

REMEMBER: The grep command is used to find patterns and will only find the specified patterns. It’s very specific! It is also very powerful when used properly.

You can do even more with this. If you want to find files older than a year and by the specific year of their creation, you could simply run a command that looks like this:

Of course, you can substitute ‘2020’ with any year you’d like and get results – so long as you have files that were created in that year.

Also, of course, that command is ONLY useful if you do not have year numbers or numbers similar to years in file names. After all, 2022 is 2022 and grep is going to find them all. That’s what grep does – it finds patterns. As such, it’s up to you to pick the patterns you’ve used and this does have a limited functionality if you’ve gone ahead and added dates to your file names.

If you do have numbers in your file names and you don’t have spaces, you can still grep for a pattern. For example, this might work assuming no space in your file name is in front of the year field – which there generally shouldn’t be:

I can’t be too specific because I don’t know if you’ve put numbers/years in your file names. If you have, grep will equally find those. This whole article assumes that you’ve done nothing of the sort.

This can be even handier and here’s a little bit of some bonus information.

Let’s say you have a directory where you’ve stored files for years. Further, you want to know how many files you created in the year 2022. This directory contains files containing many years and you don’t want to just count them.

Well, you can do something about that!

That command lists the files. The grep command then finds files created in 2022. You then pipe that output to the ‘wc’ command to count the lines.

Here’s an example output:

That means I added 8 files to that directory in the year 2023.

It’s pretty complicated. If you have years and spaces in your file names, this isn’t going to work that well for you. If you use patterns that match the output from the ls command, grep will find them. That’s what grep does.

While this does have a bit of a limited use case, it’s more of an exploration of what you can do with two simple commands. Unless you use matching patterns in your file names, this should work just famously for you. Otherwise, not so much – but you can have both fun trying AND you can look for other patterns that you can pass to grep.

Closure:

Well, that was kind of fun. We used the ls and grep commands to find files created on a specific date. There are always so many fun things to do with Linux. Many of these fun things can be done in the terminal. I like to think we both learn and have fun here on this site.

This can also be a handy tool. Let’s say you made some changes and then had some trouble later. You know you added files, but you can’t remember which files those were. Before restoring from a backup, you decide you want to troubleshoot. To do so, you start by finding files you created on the same day that you last changed your system.

Of course, this can be useful in a business setting. If you need to account for a problem, you can find the files created that day. Should there be something amiss, you can find files created on a specific date. If, for example, files were created on a date when no files should have been created… Well, you get the idea.

Perhaps more importantly, this shows what you can do with just two basic Linux commands. You’ll find ls and grep on every single desktop Linux (or server Linux) you touch. There’s no need for you to install something. You don’t have to worry about which package manager you use or building software from scratch because the developers didn’t release a package for your distro. You just use the commands that are already available.

Anyhow, this article is already too long. Sorry about that…

I kid. If I was sorry, I wouldn’t have done it in the first place! Ha! Take that!

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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Short: Show File Creation, Modification, and Access Times

Today’s article is short because there’s no reason to make it longer and we’ll just show file creation, modification, and access times. This is just a simple process and won’t take all that much to learn. It shouldn’t take too long to explain.

Files contain metadata. This can be everything from the GPS location of an image file to the kind of camera used. You can even add your metadata fields with audio files, for example.

For example, we’ve previously covered metadata in these articles:

How To: Sanitize Exif Data From Your Digital Images For Privacy Sake
Review: MetaClean (Clean Exif/meta Data From Email Attachments Automatically)

Well, your files contain other metadata. This information includes things like file creation, modification, and access times. You can easily find out when a file was created. It’s easy to show when the file was modified and just as easy to see when the file was last accessed.

Nice and simple, right?

Well, we’ll be using the stat command.

The stat Command:

You won’t need to install anything. You’ll find that the stat application is already available. You can verify this with:

The outcome should match:

You can check the man page with this command:

Doing so will show you that stat is described like:

Which is exactly what we need to show creation, modification, and access times. This will be the correct tool for the job.

Show File Creation, Modification, and Access Times:

This is a terminal-based process and you can usually access your default terminal by pressing CTRL + ALT + T. If that doesn’t work, find the terminal in your application menu.

With your terminal open, list the files:

Now, pick a file…

When you’ve picked a file, use the stat command. The syntax is easy:

When you opened your default terminal, you probably opened it in your home directory. Most of you will have a ~/.bashrc  file, so we’ll use that. An example of this stat command would be:

Here’s an example output:

As you can see, there’s the ‘birth’ (file creation time), an access time, and a changed time. There’s a lot of other information, but that’s outside the scope of this article.

Be sure to read the man page:

You can use several flags to extract just the information you want. If you wanted to, this would be useful for scripting or other programming. You don’t have to have the full output. For this simple and short article, the information isn’t that overwhelming. I see no reason to cover any particular flags unless I intended to cover a half dozen of them. You can find those just fine on your own.

Closure:

This has just been a short article. I wanted to cover the stat command and there’s not much to it – for the average user. File management is a pretty advanced topic and we cover that often. This time around, it’s just file creation, modification, and access times. Nothing too advanced.

I don’t do many of these short articles. I probably should, as they’re quick and get straight to the point. They’re quick articles that should be plenty easy to process and you don’t have to wade through a lot of text to get to the point of the article. If you like them, let me know.

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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Install Python’s PIP Part One

At first blush, today’s article may seem a bit weird – but I am writing this article to write future articles, so let’s install Python’s PIP. Yes, it may seem strange, but there’s a madness to my method! Yes, yes there is. 

Also, there’s going to be a second part to this article. I’ll link to it when it’s time.

This is something many of you may want to do, even if it doesn’t seem appropriate at this point. There are likely to be several future articles that refer back to this article. You’ll likely guess why after reading this article.

Python is a “high-level” programming language. To some of us, it’s one of the ‘new kids on the block’ but it has been around since 1991. It didn’t gain a lot of popularity until fairly recently, which might be why it seems more modern than it is. Well, to be fair, Python is modern. The language has been upgraded consistently.

So, what is PIP? It stands for PIP Installs Python, or maybe PIP Installs Packages. It depends on who you ask. Much like your regular Linux software, there are applications (written in Python) that can be installed from a central repository. This is, of course, done in the terminal – though I’m sure someone’s authored a GUI PIP installer. (Is ‘installer’ redundant?)

Now, here’s the thing… You can install PIP on pretty much every Linux distro out there. There are a zillion (and three) Python applications that can be trivially installed with PIP. This is a pretty good start at making some new and interesting software immediately available for your use.

So, this article is just going to cover how to install Python’s PIP in a variety of Linux distros. This will, of course, be in the terminal!

IMPORTANT: Read Part 2 to finish installing Python’s PIP.

Install Python’s PIP:

PIP is a terminal-based tool – to me.

Some searching sent me to this package to install Python’s PIP in a GUI. I’ve never tried it, so I can’t speak about the quality. Click the following link to learn more about using PIP in a GUI.

Use a GUI to Manage Python Packages.

Edit: I can’t actually make the above work. It also requires PIP to install it.

For the rest of you, it’s time to crack open your default terminal emulator. The majority of you can open the terminal simply by pressing CTRL + ALT + T. If that’s not an option, the shortcut to open your terminal will be in your application menu. 

Now, the syntax to install Python’s PIP is a bit varied. I can only cover those distros that I know about. If your distro isn’t covered, figure it out and let me know. If I make a mistake for your distro, you should also let me know that too!

I’m going to assume that you’re using a modern distro. There’s an older Python 2 PIP. Your modern distro should require Python 3’s PIP. So, we’ll make that assumption and run with it.

Installation Instructions for Python PIP:

Debian/Ubuntu/etc:

SUSE/OpenSUSE/etc:

Fedora/etc:

Arch/Manjaro/etc:

RHEL/CentOS/etc:

There are other ways to install Python’s PIP, I’m sure. Those directions should cover most of the more popular distros. I did a bunch of searching and that’s what I came up with to fill in what was already in my notes.

I hope the information I found is accurate because I tested only one of those commands and ran that command long ago. If you are a regular reader, you might want to go ahead with the installation at this point. You can be reasonably sure that other articles will reference this one – plus you get to enjoy the warm embrace of Python packages even without my help! (You can find ’em on your own.)

By the way, the installation syntax for Python applications via PIP is simple:

It’s that easy to install Python packages (via the terminal) when you have PIP installed. There are so many packages available and we’ll explore some of my favorites in the future.

Right now, I just wanted to prepare you for the task – and to write an article that I can refer back to, which will save me so much time. Can you imagine if I had to include this information in every article that referred to installing Python packages? Man, don’t underestimate my laziness!

IMPORTANT: Read Part 2 to finish installing Python’s PIP.

Closure:

Today’s article didn’t do a whole lot by itself. You didn’t end up with anything new, other than the ability to install Python’s PIP packages. (That ‘packages’ bit seems rather redundant!) Trust me when I say this will come in handy at some point in your Linux journey. Well, it’ll come in handy if you know about it and use it… It otherwise won’t come in handy. So, make it handy!

If you don’t want to wait for future articles, you can start exploring right now! Head to your nearest search engine and look for packages that can be installed with PIP. I’m almost certain that you’ll find at least some system utility that can be installed. You might even find some games that can be installed via PIP. You never know!

Seriously! Don’t wait for me! If you’re new to Python’s PIP, have fun with it! You can look around and find information on your own. I just facilitate things. Every article on my site could at least be figured out by reading other articles (and some documentation). You don’t need me for anything!

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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Find Recently Modified Files

Over the past couple of years, I’ve done a lot of articles about file management; this one will help you find recently modified files. There’s nothing too complicated about this, so most of my readers should be able to follow along.

There are a number of reasons to find recently modified files. Perhaps you need to assess a file system that shouldn’t have been altered. You may need to do so for some accountability process. Then again, you could want to check a system to see what’s changing and eating up your disk space.

You might want to find recently modified files for all sorts of reasons. Heck, you might have forgotten where you placed a file but recall that you did so within the past 48 hours. This can help you narrow down your search, helping you find the file more quickly.

Of course, this will be in the terminal. That’s how we do things around here. This will also be portable. You need only the find command and you’ll certainly have that available by default.

The find Command:

As I said, you’ll need the find command. This will be installed by default. You can verify that find is available with this command:

The output should match this:

Next, you’ll want to check the man page (with man find) which will show you that this is the correct tool for the job. Notably, it says this:

find – search for files in a directory hierarchy

Yup. That’s what we want to do. 

The find command is very capable and will seem complicated to the newer Linux users. It may even push some more advanced users away. I aim to make Linux approachable, so we’ll only be worried about a couple of flags.

The type Flag:

The first flag we’ll be using is the type flag. If you check the man page, you’ll see that there are many types. We’ll specify f which signifies we wish to find regular files.

The newermt Flag:

While you’re on the man page you will see references to newer but nothing specific about newermt. It’s a reference to time. Specifically, it means less than or equal to. For example, a file that’s one day old will be listed in the results if you ask for files one day old or newer. That’s what we’ll be doing in this article.

Find Recently Modified Files:

While you will find that you have the find command available in any distro I can think of, you’ll also need to know that this is an exercise that requires the terminal. There are GUI options out there, but we’ll be using the terminal. So, press CTRL + ALT + T and let’s get started!

The syntax of the command would be this:

In our case, we’re going to use the ~/Downloads directory in our examples.

The "time frame" is where things get interesting. For the find command, you can almost use plain English. The command understands seconds, minutes, hours, days, weeks, months, and years.

Let’s say you want to scan your Downloads directory for files that you have added within the past four weeks. Well, simply use this command:

If you want to search for files within the past three months, use this command:

In the case of that command, it will find any files newer than (or equal to) three months of age. It’s a very simple command to use once you understand the syntax.

You do have to use numbers. 

If you want to quickly test this, try the following:

You could have even specified that in seconds:

You can also put dates in there.

Let’s say you want to find files newer than February 1st, 2024. You can do that. If you live in the US, you might have to use a date format that you’re not used to. So, the basic syntax would be:

Or, for today’s exercise:

I’m not sure if it’s possible to tell it to use the US date formatting. I was unable to make that work in the two attempts I made at it. Let’s just say that I didn’t invest a whole lot of energy.

There’s a lot more to the find command, but this is one way to use it. The goal is small bites that help make Linux more acceptable. Even I can be overwhelmed and I’ve been doing this for years.

Closure:

Well, if you’ve ever wanted to find recently modified files, you now have the tools to do so. While there’s a lot to this command, it’s possible to use the command without being fully versed in the matter. You don’t have to know everything to take advantage of the tools. Just like you don’t have to be a carpenter to know how to swing a hammer well enough to seat a nail.

Hmm… This article isn’t even all that long!

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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.