Find a Note by Name or Date With the find Command
To find a note by name, run find . -name 'meeting*.md'. To find it by date, add a time test such as -mtime -7 for the last week. find searches a folder and everything under it, matching on name pattern, file type, and time of last modification or access).
It suits a folder of Markdown and plain-text notes, where you often remember a word from the title or roughly when you wrote the file. Below: names, times, date ranges, and what to check before you rely on an option.
Find a note by name with -name and -iname
Match a pattern
-name compares a shell pattern against the file's base name, meaning the path with the leading directories removed. Quote the pattern so your shell does not expand it first.
find ~/Notes -name 'meeting*.md'
find ~/Notes -name '*budget*'Because only the base name is compared, the pattern should not include a slash. -name a/b will never match anything. To look inside a particular folder, make that folder the starting point instead.
Ignore case
-iname works like -name but ignores capital letters, so Budget, budget, and BUDGET all match.
find ~/Notes -iname '*budget*'-iname is not required by POSIX), so read man find on your system before you depend on it in a script. If your notes use odd characters in their names, see characters to avoid in file names for what to keep out in the first place.
Find notes by modified time
Days with -mtime
-mtime n tests when a file's data was last modified, in units of 24 hours. Every numeric test takes a sign: +n means greater than n, -n means less than n, and a bare n means exactly n.
find ~/Notes -mtime -7 # changed less than 7 days ago
find ~/Notes -mtime 0 # changed in the last 24 hours
find ~/Notes -mtime +30 # changed more than 30 days agoHere's the catch: rounding. find divides the elapsed time by 24 hours and ignores any fractional part, so to match -mtime +1, a file must have been changed at least two days ago. A note you edited yesterday afternoon won't show up under +1. Surprised? Use -mtime -2 or switch to minutes.
POSIX describes the same rule as integer division by 86400 with the remainder discarded, so the behavior is the same wherever -mtime exists.
Minutes with -mmin and -daystart
For recent edits, minutes are easier to reason about. In GNU find, -mmin n tests modification time in minutes.
find ~/Notes -mmin -60 # changed in the last hourDay counts normally run back from the current moment. -daystart measures from the beginning of today instead, which helps when you mean "since this morning" or "yesterday". It only affects tests that appear after it on the command line, so put it first.
find ~/Notes -daystart -mtime 1 # modified yesterdayFind notes between two dates
Use -newermt with -not
To find files in an exact date range, -newermt takes a date and matches files modified after it. Add -not to say "before". This example, adapted from the Wikipedia article on find, lists everything modified in one month:
find ~/Notes -newermt 2026-02-01 -not -newermt 2026-03-01Read it left to right: newer than February 1, and not newer than March 1. The date argument is read as for GNU `date -d`, so other formats can work, but a plain YYYY-MM-DD is the safest.
Compare against another note
-newer file matches files modified more recently than a reference file. It fails if the timestamps are equal.
find ~/Notes -newer weekly-review.mdIt's a quick way to ask what changed since you last wrote a particular note.
Limit the search by type and depth
Add -type f to skip folders and match only regular files, and -maxdepth to stop descending after a set number of levels.
find ~/Notes -maxdepth 2 -type f -name '*.md' -mtime -7Tests are joined with an implicit AND, so this reads: Markdown files, at most two levels down, changed in the last week. By default find does not follow symbolic links, so if you keep a folder in two places with symbolic links, check how your version treats them.
Act on what you found
With no action given, find prints each match. Pipe the list to another tool to do something with it. To count the words across recent notes, pair it with the approach in count words with wc. -print0 with xargs -0 keeps file names with spaces intact.
find ~/Notes -name '*.md' -mtime -7 -print0 | xargs -0 wc -wCheck the plain list before you attach any action that changes files. The GNU manual notes -exec carries security problems and recommends -execdir. Printing first costs nothing.
What works everywhere
POSIX specifies -name, -type, -size, -newer, and -mtime, and only -print for output. Several options in this article are extensions: POSIX does not specify -iname, -mmin, -newermt, or -print0. They are common, but run man find on your machine to confirm yours has them. If a script has to run on any system, stick to the POSIX set.
Conclusion
Use -name or -iname for what you remember of the title, and -mtime, -mmin, or -newermt for when you wrote it. Combine them, add -type f, and you can narrow a large folder to a handful of files. To find when a line left a note rather than the file itself, see git log -S and -G.
Frequently Asked Questions
Why does find -mtime +1 skip a file changed yesterday?
find counts whole 24-hour periods and discards the remainder, so +1 means at least two days old. Use -mtime -2 or -mmin for finer control.
How do I search without worrying about capital letters?
Use -iname instead of -name. It is case-insensitive, but POSIX does not require it, so check man find on your system.
Can find search inside a note's text?
No. find matches names, types, sizes, and times. To search the contents of your notes, use a text search tool such as grep.