Questions tagged [find]
For questions pertaining to find, a command-line utility to search for files in a directory hierarchy. Use this tag for questions about find itself or questions about issues arising from using the find command-line utility.
3,612 questions
0
votes
2
answers
64
views
What is /usr/sbin/authserver and the binary inside
When using the find command or any other recursive file searches, I always notice /usr/sbin/authserver in the context of a "permission denied" error. Just out of pure curiosity, what ...
7
votes
3
answers
509
views
How to separate start directories and expression in `find`?
find takes an (optional) list of (what the man page calls) "starting points", i.e. directories, followed by an expression. Is there a way to cleanly separate both types of arguments so that ...
0
votes
2
answers
109
views
find and regex matching behavior? Why won't 'L1[0-6].*' match "L15a" [closed]
I'm trying to understand some subtle behavior of find and its -regex option
I am trying to create symbolic links from files entitled slides_.*.pdf in folders that start with L1[0-6]. I tried the ...
1
vote
2
answers
134
views
find awk grep - search and replace & passing modified contents to awk to overwrite the existing file
I have a folder with many subfolders full of various Quarto(reg) files & in those files there are links that are located in varying positions in the file lines.
UPDATE ON 3 November 2025 in ...
6
votes
3
answers
377
views
Help w/ "posix-extended" regex for 'find'
Can someone explain the issue I've described below, and perhaps suggest a resolution?
I'm trying to process a set of filenames using find. My platform is macOS (Ventura 13.7.7), and the shell is zsh ...
4
votes
4
answers
460
views
How can I find common prefixes in file names to group them?
I would like to be able to find all files in multiple directories whose file names start with the same string, but preferably not if that string is only one word or contains fewer than perhaps 5 ...
1
vote
0
answers
58
views
What can go wrong with this command for flatten a directory recursively?
I have a very messy deep file hierarchy tree of files with duplicate names in different directories and possibly even duplicate files with different names.
$ find mp4/ -type f | more
mp4/._.DS_Store
...
0
votes
2
answers
103
views
Listing all the files and directories which have been moved in order on a drive
In my notes I had written:
To find most recently deleted files. Note: This will not search deleted files on external drives.
find ~/.local/share/Trash/files/ -type f -printf '%C+ %f\0' |
sort -rz | ...
11
votes
5
answers
1k
views
Using `find` to find a file in PATH
I would like to be able to search all my $PATH for files matching a given pattern.
For example, if my PATH is /usr/local/bin:/usr/bin:/bin and there's a /usr/local/bin/gcc-4 and a /usr/bin/gcc-12, I ...
6
votes
1
answer
402
views
About security concerns using in find -exec vs interactively performing the same task
My question is not aimed specifically at understanding find's and its -exec option's security implications, but more generally at understanding why (if at all!) such programs are particularly ...
-1
votes
3
answers
159
views
zgrep - Find an IP address in 1200 *.gz files
I want to find out in which of my 1200 *.gz files a certain IP address occurs on a certain date (17.07.2025).
I could not find the IP address in my current logs:
grep 'IP address' *.logs
My attempt ...
2
votes
3
answers
414
views
Create Subfolders for files and move them into, each for themselves
In Linux in a Folder there are these files:
LQ0gfKQej7GKG44Cn0sSAC.part01.rar
LQ0gfKQej7GKG44Cn0sSAC.part02.rar
LQ0gfKQej7GKG44Cn0sSAC.part03.rar
LQ0gfKQej7GKG44Cn0sSAC.part04.rar
...
0
votes
1
answer
85
views
Why does `find` have the tests `-anewer` and `-cnewer`, but not `-mnewer`?
(This is more a question out of curiosity and less a present problem that needs to be solved)
I recently learned more about time-related tests in GNU find, and something caught my eyes: With files, ...
6
votes
1
answer
730
views
How to find files by size that are not divisible by 4096 and round them up
In Linux in a Folder there are many files, all created with fallocate with random size.
How to find files whose size is not divisible by 4096 and correct the filesize (rounded up) to a multiple of ...
-4
votes
1
answer
129
views
How combination of find with sh solves problem with filenames
I was directed to this StackExchange post:
Why is looping over find's output bad practice?
The core issue is that Unix filenames can contain any character except the null byte (\0). This means there ...