find is a command line utility to search for files in a directory hierarchy

learn more… | top users | synonyms

9
votes
1answer
213 views

How is updatedb so much faster than find?

How is updatedb so much faster than find? Here's a timed comparison between updatedb and a find command that does a seemingly similar task. compare.sh #!/usr/bin/env bash cmd="sudo updatedb" echo ...
0
votes
1answer
35 views

find returns 'No such file or directory'

Continuously getting so many warnings yet my command is working fine. find: `api/PlayersImpl0.smali': No such file or directory find: `api/PlayersImpl1.smali': No such file or directory find: ...
0
votes
1answer
23 views

Want to use find with rsync in script

I'm trying to make a script that will run in cron, that will search a path for specific file name. In the path there might be more folders with that same file name. If found and they are newer than 2 ...
1
vote
1answer
24 views

Using find -perm to find setuid files

I want to find list of all suid binaries. I use the command find / -perm 4000 However this does not give me any output. I understand that the SUID file may be in 4xxx permission mode. But if I ...
1
vote
2answers
121 views

How to use logical OR in find?

In bash shell ls can use a logical OR functionality through (of course I could also do ls name1 name2 but my true examples are more complicated): ls @(name1|name2) Is there a way to do this using ...
2
votes
3answers
40 views

Find a directory which contains all the files in my list

I have moved a file, which makes a reference to four other files with the same parent directory. And now I am stock trying to figure out which parent directory that is since there a number of files ...
0
votes
2answers
30 views

How to find file that has read permissions from root directory?

I am trying to find files with read permissions from root directory and save them under /home/student/abc direcory: find / -type f -perm a+r -exec cp /home/student/abc {} + but it shows me the ...
3
votes
2answers
123 views

To count number of matches in a mega string quickly

I have big text-data without spaces and without other rows in one line. In reality, the streams are 0.2 Gb/s, similar situation here, but in this task, counting occurrences which is more challenging ...
1
vote
1answer
21 views

Find folders of a given age, then filter for a given size and delete the matching folders?

I've been having trouble with this for some time. Here is what I finally came up with that seems to work, though I have very limited abilities with piping. I'm guessing this is a poor way to achieve ...
1
vote
2answers
41 views

Exec condition and xargs in Find simultaneously

I am trying to include the standard C package stdint.h to files which have the word LARGE_INTEGER, as a part of conversion from Windows to Linux drivers as discussed here for datatypes. I know the ...
8
votes
5answers
349 views

find | xargs shasum creates checksum of checksum file itself (prematurely) and fails when checking

My problem (in a script with #!/bin/sh) is as follows: I try to checksum all files in a directory for archival purposes. The checksum (in my case sha1) file with all filenames should reside in the ...
3
votes
1answer
143 views

GNU Find this but not that and do Sed?

Code find /tmp/ -type f \ \( -name "*.h" \) -o \( -name "*.cpp" \) -o \ \( \! -name "*.bak" \) -exec \ sed -i ...
0
votes
2answers
76 views

Special meaning of '{}' ';' with find

User-define action is a feature of Bash in linux. In Linux terminal if I write root@localhost: find ~ -type f -name 'foo*' -ok ls -l '{}' ';' then it checks if there is any filename starting with ...
2
votes
3answers
126 views
+100

locate alias with find

On small systems where there is no locate installed, How would an alias look like that gets the same result as locate? I can imagine find can produce the same output so an alias could look like ...
0
votes
1answer
25 views

Find directory names with N occurences of a set of characters

Sorry in advance, I know there are hundreds of posts about find, but I genuinely don't understand what's happening here and haven't been able to find a definitive answer to this question: how to match ...
3
votes
5answers
126 views

Use of find command to rename files

I have a list of 10K mp4 files some of which contains a ? mark. I need to replace these with _ (underscore). I can use find command to find these files but not sure if I can rename them. find . ...
1
vote
1answer
52 views

Find command fails to copy few files

I am using the command below to copy files created in the last minute. I scheduled the script which contains this command to run every one minute, so that the files can be copied as soon as the file ...
1
vote
2answers
35 views

Utilizing The 'find' Utility - Wrong Pattern?

I've been trying to find a particular shared object within ./lib/ using the 'find' utility in the bash shell. To be more specific, to find this shared object I wanted to find all files that started ...
0
votes
1answer
42 views

How can I use sed to find a string and replace another string on a different line? [closed]

I have a file like this: BEGIN Name "TIPO_RECORD" SqlType "12" Precision "255" Name "Test" SqlType "12" Precision "255" Name "xxxx" SqlType "12" Precision ...
0
votes
1answer
29 views

How do I find a directory or a file in Linux file system [closed]

I am using the find command in my Android image; a image which I developed myself and put in an example of a dynamically loadable module. I put the code in the /example directory of my source code, ...
3
votes
2answers
60 views

Script for changing modification time of files and directories recursively

I have many big folders with thousands of files in them and I want to use touchto set their modification times to be "original time"+3 hours. I got this script from a similar thread in superuser: ...
3
votes
1answer
68 views

Filename Expansion: Find Utility Pattern Matching vs Bash Shell Pattern Matching

For filename expansion, the 'find' utility's '-name' option seems to function similarly, but not exactly the same as the bash shell's builtin pattern matching. Here are the relevant sections of the ...
4
votes
2answers
110 views

Difference between find ~ and find *

What is the difference between find * and find ~ for searching a file? In terminal when my present working directory on root,then in terminal root@devils-ey3:~# find * -print -quit ~ On same ...
2
votes
2answers
27 views

In find -perm, what's the difference between “+6000” and “/6000”?

I'm trying to find all the setuid/setgid binaries on my system. I've found two different ways to do this online. What's the difference between find / -perm +6000 -type f and find / -perm /6000 ...
1
vote
1answer
18 views

How do you use 'find' to update ownership of all directories, files, and symbolic links in a folder?

I'm trying to update the ownership of everything in a directory tree from me to root. I'm using find to do it a little more carefully than a recursive chown. Here are the commands I use to change ...
2
votes
3answers
124 views

Find command returns different results when -print0 is added

When doing a search like find -type d, adding the -print0 argument right after the find command such as find -print0 -type d causes the search to return more results than without it.
1
vote
1answer
30 views

Trying to find all files in certain directory that are not referenced in other files

I have this project that has a images folder with images in them and I'm pretty sure some of them are not used. So I'd like to list all images that are not referenced in any other file. I'm not very ...
1
vote
1answer
56 views

piping commands after a piped xargs

HP-UX ***** B.11.23 U ia64 **** unlimited-user license find . -type d -name *log*|xargs ls -la gives me the directory name(the ones which contain log in the directory name) followed by all files ...
2
votes
2answers
54 views

is it possible to search for files that have a special Linux file attribute?

is it possible to search file in the linux OS that have particular file attribute as this: ---S--l--- ---S--l--- 1 root root 0 Mar 1004:25/opt/csTuner/iba/wys/tuer_lolk What is S in ...
4
votes
2answers
121 views

find and negation of an -iname condition

I am trying to find all the files which have 'pillar' in the name (case incentive) and do not contain 'cache' (also case insensitive) with find . -iname '*pillar*' -and -not -iname '*cache*' but it ...
1
vote
2answers
45 views

Find file which name contains given substrings simultaneously

In general, it's often needed to find a file whose name should contain several substrings simultaneously. How do I do that with bash? For example, "boost", "qt" and "linux" in a file called "How to ...
0
votes
1answer
24 views

Copying files containing specific text preserving directory structure

Using the code in this answer, I can easily copy a file containing specific text from one folder to another. With the -r option I can also search inside directories recursively. The result is that ...
0
votes
2answers
63 views

Shell Script: Use “find” to execute shell a command that contains “filename”(without extension) returned from “find”

I have several files with extensions "*.f90" in directory-A. I want to apply the following command for each file in shell script. e.g. filename.f90 f2py -h filename.pyf -m filename ...
3
votes
1answer
92 views

Find, count and sort all audio files. ALAC (M4A) files

I'm putting a script together to sort a very large music collection. It's approx 22000 albums, a mixture of FLAC, WAV, AIFF, M4A (AAC & ALAC). So far, I can sort by file type and get a total size ...
20
votes
9answers
2k views

Find files whose name is 4 characters long

I would like to find files whose name has only 4 characters. Example, there are three files under /tmp: $ ls /tmp txt file linux Output should only show file because it only has 4 characters.
1
vote
2answers
32 views

searching for files with multiple strings (all inclusive, not one or the other ) and print line numbers

I want to search for 2 (or more) strings across the files of a certain directory and print the line numbers. The search results should include only those files where all the mentioned strings are ...
1
vote
3answers
57 views

How can I replace string in all files in a directory and all sub-directories without changing any of the hidden directories/files?

I am using the following command find . -type f -exec sed -i 's/_backpack.html/_backpack_cal.html/g' {} + I expect all "_backpack.html" strings in my project to be replaced to _backpack_cal.html ...
4
votes
3answers
79 views

Find largest files from each date in a directory

I have a directory similar to the following: -rw-r--r-- 1 root root 223K Apr 28 14:25 2015.04.28_14.25 -rw-r--r-- 1 root root 253K Apr 28 14:55 2015.04.28_14.55 -rw-r--r-- 1 root root 276K Apr 28 ...
0
votes
1answer
28 views

Openssl on files found with find unix command

Total noob with shell scripting here. I can find the files I'm looking for with something like this: find . -name "*.mp3"; What I want is something like this: find . -name "*.mp3" -exec openssl ...
1
vote
1answer
45 views

Stopping find command after finding files in one directory

I have a command in a Korn script which is like as written below, find <path1> <path2> <path3> -name filename After this, it stores the output in a txt file. Using this txt file ...
1
vote
4answers
43 views

What is the best way to delete files & folders in a directory excluding the contents of one folder? [duplicate]

I'm trying to automate some file house keeping I do pretty often. I want to delete all of the files and folders in a directory while excluding the folder "./xfer" and its contents. I've bee trying ...
2
votes
3answers
109 views

find directories with specific patterns leads to Permission denied error and no result

I have this kind of shell script on Linux: #!/bin/sh echo -n "Please enter directory pattern: " read dirs find $dirs > /tmp/justbay.txt allDirs=$(find $dirs ! -readable -prune) echo $allDirs ...
3
votes
4answers
50 views

find on a set of dirs that may not exist

I need to invoke find on a set of "starting points" which is generated, but some of paths may not be valid: paths() { # # mock version of the generator # echo /bin echo kjsdfhk ...
1
vote
1answer
38 views

find command skips file

I'm trying to find a file, but for some reason it is omitting a directory or a file don't know yet. If I run this cd ~/Documents/GamesTeam/games/ichristo_dev find . -name PayoutTest.sh gives ...
1
vote
2answers
84 views

Find largest files of a particular owner

I accidentally chown'd my entire file system to a particular user, after correcting the issue I've found disk space still being consumed by that particular user's files even though their account ...
-4
votes
2answers
40 views

Displaying a list of all *.java

Display a list of all java files which name is *.java in your current working directory which contain the string Example, regardless of the case sensitivity of the latter's individuals letters. ...
1
vote
3answers
56 views

Find a file with the extension .csv in a directory matching a pattern

I have a folder in which I have many subfolders. The Root folder name is allCSV and sub foldername is will be like a_date(s), b_date(s), c_date(s) ... I want a file which is in a_date(s) and ends ...
2
votes
2answers
39 views

Copy files with parent folder to a new directory

I want to copy some files and include their parent directory in the process. The current structure is similar to: /Module1/A/downloads/m13312/file.pdf /Module1/A/downloads/m17312/file.pdf ...
0
votes
1answer
47 views

help with remote file find/scp

I have a set of files on a remote sftp which I need to download to a server every day. sftp uses ssh keys to authenticate, so I created a ssh key and added to the remote server authorized folder. I'm ...
2
votes
1answer
27 views

Efficiently finding a file/directory based on keyword

I have a large directory tree of builds. Standard find search locates the file after a minute or two. I'd like it to be in a few seconds. I need to find a file named foo.tar.gz. The file can reside ...