On Sat, May 16, 2026 at 14:55:54 -0400, Karen Lewellen wrote:
> So, if I want to find items ending in .txt from a certain date window, what
> am I missing?
As you're adding complexity, I would move away from the "ls + text editor"
approach and toward find.
> I understand the start syntax of the following, still unsure if find needs
> to be run in quotation marks however, so
> find - name *.txt -print
> would print the files ending in .txt to the screen.
> where would the date be added, and where does that land in the syntax?
OK, to answer your questions:
1) In this command, the * character needs to be quoted. Usually, people
will quote the entire word *.txt instead of just the *, but there
are many different valid ways to write it. '*.txt' or "*.txt" are
the most common.
2) If you want to add date information to the output, the simplest way
would be to use the -ls action instead of the -print action.
Now, two minor corrections:
1) You wrote "- name" but this should be "-name".
2) find is supposed to be given a starting directory. GNU find lets
you omit this argument, and assumes "." as the starting directory.
However, I still prefer using the correct syntax.
Putting it all together: to list all the files ending with .txt including
modification times, you can use:
find . -name '*.txt' -ls
If you want more control over the output, you can replace -ls with a
more complex action, such as -printf FORMAT:
find . -name '*.txt' -printf '%t %p\n'
That shows the modification time in a human-readable format, and the
full relative path, for each file whose name ends with .txt.
If you want to include date restrictions, you can add those as well:
find . -name '*.txt' -mtime +5 -mtime -11 -printf '%t %p\n'
That one would show files whose names end with .txt, and whose
modification time is more than 5 days ago, and whose modification time
is less than 11 days ago.
This is just a starting point. find can do a *lot*.