Skip to main content

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.

Filter by
Sorted by
Tagged with
0 votes
2 answers
65 views

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 ...
Rumi-SE Must Follow the CC-SA's user avatar
7 votes
3 answers
510 views

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 ...
Florian Brucker's user avatar
0 votes
2 answers
109 views

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 ...
mikemtnbikes's user avatar
1 vote
2 answers
135 views

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 ...
iembry's user avatar
  • 205
6 votes
3 answers
377 views

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 ...
Seamus's user avatar
  • 3,904
4 votes
4 answers
462 views

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 ...
EmmaV's user avatar
  • 4,443
1 vote
0 answers
58 views

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 ...
Niklas Rosencrantz's user avatar
0 votes
2 answers
103 views

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 | ...
1toneboy's user avatar
  • 493
11 votes
5 answers
1k views

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 ...
umläute's user avatar
  • 6,734
6 votes
1 answer
402 views

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 ...
Enlico's user avatar
  • 2,362
-1 votes
3 answers
160 views

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 ...
fl1tz's user avatar
  • 1
2 votes
3 answers
414 views

In Linux in a Folder there are these files: LQ0gfKQej7GKG44Cn0sSAC.part01.rar LQ0gfKQej7GKG44Cn0sSAC.part02.rar LQ0gfKQej7GKG44Cn0sSAC.part03.rar LQ0gfKQej7GKG44Cn0sSAC.part04.rar ...
Banana's user avatar
  • 241
0 votes
1 answer
85 views

(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, ...
Henning Kockerbeck's user avatar
6 votes
1 answer
730 views

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 ...
Banana's user avatar
  • 241
-4 votes
1 answer
129 views

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 ...
Filangieri's user avatar
2 votes
2 answers
129 views

Run command find /volume1/Ingest -not -name '*.txt' -mtime +1 -print and got the following output /volume1/Ingest/test/Cube Emergency Lighting Locations Aug 2018.pdf /volume1/Ingest/Cube Microplex ...
Ben Edwards's user avatar
-1 votes
1 answer
98 views

I want to list the dependencies of all the shared libraries residing in a directory. I'm using ldd -r command to list the dependencies of a given shared library and redirect that output to a text file ...
Harry's user avatar
  • 239
0 votes
1 answer
65 views

I'm trying to list files recursively with this date format YYYY-MM-DD on a on FreeBSD. I tried the Linux commands I know but none of them worked : $ ls -lR --time-style=+'%Y-%m-%d %T' ls: unrecognized ...
SebMa's user avatar
  • 2,473
3 votes
1 answer
270 views

We are using command find $$dirpath_err -maxdepth 1 -type f -name "*XYZJPQ*_"`date +%m_%d_%Y`"*standard_error.csv" but the file is generated as ...
Sanjay Dubey's user avatar
2 votes
0 answers
89 views

On a MacBook, I tried to access one of the system apps, Maps.app which is normally a folder stored in /System/Applications on a separate volume (here mounted as /System/Volumes/Data). What I found odd ...
fstanis's user avatar
  • 121
2 votes
0 answers
127 views

on a directory containing ~26 million files, GNU Find is 10 times faster than BusyBox find, why? /var/www # time find /var/www -regex .*\.\(php\|js\|json\|html\|htm\|css\) -not -regex \(.*/docroot/...
hanshenrik's user avatar
0 votes
1 answer
104 views

Recently when I read one QA, it has some unexpected behaviors for me: ~/findtest % echo three > file\ with\ \"double\ quotes\" ~ % find findtest -type f -exec sh -c 'set -x;cat "{}&...
An5Drama's user avatar
  • 173
1 vote
1 answer
56 views

How can I show list of all unhidden files on my Mac Terminal using find command while using relative path for patent directory as param (i.e. ../../) ? I tried, find ../../ -path "*/.*" -...
Sazzad Hissain Khan's user avatar
4 votes
2 answers
461 views

Consider the following example: mkdir /tmp/test2 && cd /tmp/test2 mkdir -p aa/{tmp,src} mkdir -p bb/aa/{tmp,src} mkdir -p {dd,ee}/bb touch {dd,ee}/bb/aa tree | awk '{print "# " $0}' ...
sdbbs's user avatar
  • 590
0 votes
1 answer
191 views

I am trying to remove junk from rsyslog directories (mainly a lot of empty sub-directories or sub-directories with a single partial log file) but with all kinds of different names ranging from words ...
J Telep's user avatar
  • 207
0 votes
2 answers
74 views

What is the find script to sort a subtree into files with the most recent modification time? Also preserving their path name? I suspect it has something to do with find, ls, awk and sort. I haven't ...
atod's user avatar
  • 155
-1 votes
1 answer
85 views

Does anyone know how the Unix find search -name queries with _? in leftmost column relate to Kleene Star as defined on Wikipedia? How can I accomplish the rows with _? using find? . : empty ...
notaorb's user avatar
  • 101
0 votes
2 answers
189 views

I'm trying to filter out files using find, however am having difficulty. Does anyone know the correct command to filter out "Untitled.rtf" using file permissions? BSD like? -rwxr-xr-x@ 1 X ...
Nick's user avatar
  • 205
0 votes
2 answers
107 views

I have a file which contains whitespace in its name: my file.txt. If I want to find a file which has this name and pipe its output to a vim with args, I must use --null|-0 in order to handle ...
glacier's user avatar
  • 491
0 votes
1 answer
25 views

I have two Suse 15.6 servers, both have the same directories and files; the first example running on a GCP VM and the other on an VMWare VM. Not sure which ENV var I'm missing, since both have declare ...
mariano-daniel's user avatar
1 vote
6 answers
367 views

I have a lot of webpages saved in my Download folder and I want to move all html files together with its folder (for every "NAME.html" exists "NAME_files/" folder). The big ...
Antonio's user avatar
  • 193
2 votes
1 answer
91 views

This question is answered on another stackexchange (stackoverflow) but I couldn't find it because I searched for the answer here. I'm posting my question here so the answer is easier for the next ...
Daniel Kaplan's user avatar
0 votes
1 answer
77 views

Trying to test that my sed works by filtering through the files again with grep. There may be hard but succinct ways but I'd prefer some idiomatic way to remember. This fails: find src -type f -name &...
user avatar
0 votes
1 answer
125 views

To find and remove empty files, I have found the following Stack Overflow question: https://stackoverflow.com/q/3157343 There are about 10 answers there, but all of them use -size 0 and not -empty. E....
jsx97's user avatar
  • 1,387
0 votes
0 answers
42 views

I am trying to find out a way to do incremental antivirus scan. My current approach under evaluation is using "find". You can see relevant question here: Is there a reason why I can't ...
user1578026's user avatar
4 votes
3 answers
1k views

I need to scan Linux systems for viruses/malware, on the entire file system. There are few options to consider. One is normally what users do: Use antivirus to scan system once a day. The second ...
user1578026's user avatar
0 votes
2 answers
112 views

First, I got the total size of folder /my-downloads: $ du -sh /my-downloads 304G /my-downloads As you can see, it's 304G. Then, I wanted to find out the total size of all immediate directories ...
Logan Lee's user avatar
  • 259
2 votes
2 answers
238 views

Consider the two commands below which are scheduled to run at the same time (Via Autosys, at exactly 8 AM). The find command removed files older than 15 days but exited with non-zero status with: ???...
Veera V's user avatar
  • 87
0 votes
1 answer
279 views

I have up to terabytes of data (a large number of smaller files) that could contain wrong owner, group or permissions. To repair that we had a script doing sudo -n chown -R user:group "/path"...
jan's user avatar
  • 105
2 votes
0 answers
102 views

I'm trying to cleanup some files on a Debian 11 machine. These files live in a subdirectory in: /tmp/.debrief, or /opt/site/var/debrief I can identify them by the extension in their filename: ....
Stewart's user avatar
  • 16.1k
2 votes
0 answers
60 views

Suppose I want to do this: find . -exec tool {} extra-arg + It doesn't work and I know why: -exec … {} + does not allow extra-arg(s) between {} and +. So be it. It seems I can inject the extra-arg by ...
Kamil Maciorowski's user avatar
3 votes
2 answers
155 views

I'd like to know if it's possible to write a POSIX compliant script that builds a find command from its arguments. The way to do it for Bash (and zsh) is explained in this other SE article but it's ...
PRouleau's user avatar
  • 305
0 votes
1 answer
102 views

I try to use find to find files... that are hidden using chflags, like chflags hidden my_file or the filenames of which start with a period, like .my_file and ignore macOS-specific .DS_Store files ...
jsx97's user avatar
  • 1,387
1 vote
1 answer
123 views

Short background; I have a script I run to put new TV episodes into my library after conversion and naming. It just locates the matching directory by name. Recently I fsck'd my drives, and it warned ...
Naf's user avatar
  • 11
1 vote
1 answer
51 views

find . -type f -size +390625 -prune '/oracle' -exec ls -lh {} \; find: bad option /oracle Just want to find all large files on system but exclude /oracle. Thanks in advance.
No Relocation's user avatar
5 votes
1 answer
2k views

I have the following directory structure on a macOS machine: dir1/ |- file1.txt |- dir2/ |- file2.txt |- dir3 |- file3.txt I then run these two find commands: find . -depth 1 -path '*.txt'...
jsx97's user avatar
  • 1,387
0 votes
1 answer
95 views

I want to exclude all C files that have a matching asm file. The assembly files all have _x86_64.S at the end. The C files have identical names, but with .c instead of _x86_64.S at the end. How would ...
Ryan Maguire's user avatar
1 vote
2 answers
125 views

Is there an environment variable I can set to be read by find (WSL Ubuntu 20.XX LTS) so that it never searches paths that contain, for instance node_module or .git when find runs a search? Or would ...
leeand00's user avatar
  • 4,971
1 vote
1 answer
153 views

I can't understand what "-f" option to find command on NetBSD mean. Manual: https://man.netbsd.org/find.1 says -f Specifies a file hierarchy for find to traverse. File hierarchies may ...
SekstusEmpiryk's user avatar
2 votes
1 answer
183 views

I'm trying to replace symlinks in my current directory with the files they point to. I thought I understood 'cp' and the '-L' argument, but apparently not. Here's the command I am using find ./ -...
mikemtnbikes's user avatar

1
2 3 4 5
73