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

learn more… | top users | synonyms

5
votes
1answer
260 views

Exclude directory in (native Solaris) find command

I'm trying to exclude the directory /zones in my find command. I don't have GNU find available, just the native Solaris find. I tried something like this: find / -type d ! -name zones The problem ...
1
vote
1answer
56 views

copy files with md5-based target name using find and xargs

I have a directory tree with many .dat files, where many of them contain special characters. They are used by another process which is only able to process files containing ascii characters. My idea ...
0
votes
1answer
107 views

How to pull one day old data from remote server to local server?

From what I have searched till now I only found command to PUSH one day old data from local server to remoteServer but what I want is to PULL one day old data from remoteServer to localServer. I ...
1
vote
1answer
48 views

List folders greater than 10G and mail to respective owners about the usage

In our environment, we have an NFS mount which contains all users home directories. I want to find the users whose home directories sizes are greater than 10G and send a notification to them. I tried:...
2
votes
1answer
127 views

Cp files into subdirectory with find -exec

Why is this command not copying the 17 .png files into a sub-directory within my current directory? $ find . -maxdepth 1 -mtime -3 | wc -l 17 $ find . -maxdepth 1 -mtime -3 -print0 | grep -z loader |...
1
vote
1answer
92 views

POSIX-compliant recursive grep with no errors for inaccessible directories

What script would allow me to grep a keyword and print the filename containing the keyword inside the file content, for example 'Carhart' inside all .sas files in all subdirectories? I tried something ...
3
votes
3answers
617 views

How can I exclude all “permission denied” messages from “find” in Solaris

Hi previous questions on this topic contain answers for Linux but does not work for Solaris 10. find . ! -readable -prune Does not work in solaris since -readable is not POSIX. What is the POSIX ...
2
votes
2answers
108 views

How can I list files by class/indicator (as in ls --classify) then by name?

ls --clasify append indicator (one of */=>@|) to entries. I would like to group the entries of the same class/indicator together. I can only find ls --group-directories-first for grouping the / ...
1
vote
1answer
44 views

Add arguments to last invocation of `find … -exec $COMMAND {} +`

I'm generating ctags using something like the following line find -iname '*.[hc]' -exec ctags -a --sort=no {} + The result is that tags are not sorted. For that I'm using sort -u -o tags tags ...
3
votes
2answers
114 views

How to alias part of expression for find?

I prefer regular expressions with -regex over the shell pattern syntax of -name. I also want to use the posix-egrep type, so I'd like to do something like alias find="find -regextype posix-egrep" ...
0
votes
2answers
203 views

How could I run -exec on find command after | grep

I am on a remote machine attempting to move all loader.gif files into a /Pictures folder find . -iname *.gif | grep loader shows four file I would like to move, naturally I tried: find . -iname *.gif ...
2
votes
1answer
315 views

How to use regex inside exec with find?

Is it possible to use regular expressions based on the result (file name) inside the exec argument with find? I want to be able to "exec" based on parts of the argument, like: find . -name pattern -...
4
votes
1answer
87 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
45 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
190 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
115 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
104 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
315 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
49 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
866 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
212 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 directories and check. I would like to ...
3
votes
2answers
351 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
232 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
58 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 /home/tjuh/....
1
vote
1answer
251 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 ...
-1
votes
1answer
3k 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
85 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 general/header....
0
votes
2answers
631 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
65 views

“find” function still prints 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. Does anybody know why ...
0
votes
0answers
97 views

Help with find function in Linux

I searched around and couldn't 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. ...
0
votes
2answers
185 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
62 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 server. Sftp processes the files, and moves it to another tool, by appending the file size at the end of the file name. For ...
0
votes
1answer
127 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
540 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
413 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
0answers
182 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: `api/...
0
votes
1answer
69 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
216 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
612 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
112 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 ...
1
vote
2answers
52 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
158 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
25 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
127 views

find: multiple `-exec`s with conditions

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
530 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
188 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 '1s/^/#...
0
votes
2answers
96 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
300 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
65 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
1k 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 . -...