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

learn more… | top users | synonyms

4
votes
1answer
60 views

How do I find a file name that's exactly 8 levels deep?

I'm using the 'find' command to search for files in a backup system. I want to find all file names containing a certain string (e.g. 'XYZ') that are exactly 8 levels deep. Is there a find syntax that ...
1
vote
2answers
25 views

Find and move directory to a new directory based on name [duplicate]

I would like to move all the folders contained in the folder "/example" named e.g. "*_jony" to a new directory call "/jony". I have try several way without success! It would be great to have some ...
0
votes
2answers
37 views

How to find all .zip and .rar files recursively and sort them by size [duplicate]

I am looking for all .zip and .rar files in comp_tuts folder and I am intersted in showing their file sizes and sorting them from biggest to smallest. I have tried ls -R *.zip ls: cannot access ...
0
votes
1answer
39 views

Find part of String and replace entire string in a file

I have a file named A.xml which contains a strings such as "Ticket_Release1" and "Ticket_V2". I want to find and replace all the strings in the file starting with Ticket_ with something called ...
0
votes
1answer
49 views

find files in a folder

I'm trying to make a FIFO script that keeps deleting files when disk usages reaches a limit. I have used the find command so that number of files wont be a limit to run the script. But I get an error ...
0
votes
1answer
62 views

How can I find and replace only in a range of columns?

I have a text file with 9267 lines. I want to find "A" with 5 spaces after it and replace it with "A" with 5 spaces before and after it on all lines, but only between columns 67 and 88. Text outside ...
1
vote
1answer
33 views

How do I find directories where none of the files inside have been accessed in a year?

I have a tools directory /tools/tool_name that has hundreds of releases of the tool inside. I am trying to find an easy way of knowing what releases can be archived. Is there an easy way of finding ...
2
votes
5answers
403 views

How to grep all xml files that do not begin with “<”

How can I find all xml files in the current directory and all sub directories, that do not start with < in the first line. I have tried this, but the grep doesn't work: find . -type f -name ...
0
votes
5answers
86 views

List only the count of all files/directories for the directory tree of present directory

I want to list the number of directories under each subdirectory tree of the present directory. As there are too many directories, I can't go into individual directory and check. Something like the ...
3
votes
2answers
119 views

rm not deleting file, thinks its a directory

I have a hard drive with windows loaded on it hooked up to my Linux machine for backing up some of the information. I want to delete one of the 'temporary internet files' folders and it deleted all ...
1
vote
3answers
29 views

To Rsync files where permission denied

I want to find those files which I cannot copy to another location such that I could do Rsync. I have an external HDD and my system´s HDD. The external HDD has files which my system is missing. I ...
0
votes
3answers
30 views

Excluding a folder from deleting empty files with find

I usually delete empty files and folders in my home directory with find using the following command: find /home/tjuh -empty -delete However I would like to exlcude one folder, namely ...
1
vote
1answer
35 views

What does this find error mean: “find: stat() error /hgfs: Operation not applicable”?

When I use the find command on Solaris 10, I get the following error message: find: stat() error /hgfs: Operation not applicable What does this error mean? NOTE: the output from mount: $ mount -v ...
-2
votes
1answer
34 views

Explanation of % directives in find -printf

find /tmp -printf '%s %p\n' |sort -n -r | head This command is working fine but what are the %s %p options used here? Are there any other options that can be used?
0
votes
4answers
59 views

Copying Only Directories With Files

I am trying to copy files and the directory it is in to another location. I can find the path like this: find ~/dim_import/* -type f ! -name xdir | cut -d '/' -f 5-10 which outputs ...
0
votes
2answers
55 views

How to find manually installed program in Linux Mint

Yesterday I installed Android Studio. I didn't install via the package manager or Software Center. Instead, I downloaded the ZIP package and installed it. After the installation, Android Studio worked ...
0
votes
1answer
52 views

“find” function still print files I've already removed

I've removed some directories and files inside them using sudo rm and sudo rmdir, but when I execute sudo find /*/*/ng* the files I've previously deleted are still showing up, anybody know why and ...
0
votes
0answers
38 views

Help with Find function in Linux

I searched around and couldnt find this so sorry if it's another duplicate. Using Kali linux I am to find a file who is owned by user bandit7, owned by group bandit6 and is 33 bytes in size. However, ...
0
votes
2answers
53 views

How to find file without knowing the name of it [duplicate]

So I've finally given up after searching/trial and error for an hour now on how to find a file given specific criteria (none of which is the name of the file or the extension). The file info provided ...
1
vote
2answers
33 views

Script to Compare the “file size” with “last name of file” and if unmatched delete the file

In my environment, we'll be receiving files from clients into our Sftp. Sftp process the files, and move it to another tool, by appending the file size at the end of the file name. For example, ...
0
votes
1answer
27 views

Command to delete directories whose contents are less than a given size

I'm working in a directory ~/foo which has subdirectories ~/foo/alpha ~/foo/beta ~/foo/epsilon ~/foo/gamma I would like to issue a command that checks the total size under each "level 1" ...
3
votes
1answer
129 views

custom delimiter for unix find results

I want to use find to find some files, and return all files as a single line (without newline characters), and a custom delimiter between the files. So for example the result for three files would be ...
9
votes
1answer
246 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
45 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
29 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
35 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
132 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
43 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
32 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
126 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
47 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 ...
9
votes
5answers
376 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
152 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
81 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
4answers
216 views

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
27 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
156 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
61 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
32 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
71 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
87 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
113 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
31 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
19 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
138 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
38 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
64 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 ...