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

learn more… | top users | synonyms

1
vote
2answers
143 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
1answer
182 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
1answer
294 views

Find only in directories n levels deep

I use this command to find and run all istances of wp-cron.php I have for each site I have: find /var/www/ -name 'wp-cron.php' -exec php -q "{}" \; Since my websites tree is: /var/www/site1/htdocs/...
1
vote
2answers
464 views

find files with path of a directory exclude subdirectories

How can I use find to traverse a directory, but not recurse into its subdirectories? I tried -prune and it does not work. And there is no -maxdepth option. find /opt/projectname/bin -type f /opt/...
1
vote
1answer
371 views

Find all the modified svn files and copy files modified in the same folder structure

I get all the modified svn files using svn st | grep ^M command M student/includes/class_student_promotion.php M student/includes/class_student_report.php M student/resources/js/...
1
vote
1answer
48 views

find's - cnewer broken on NTFS-3g?

After extracting an archive to the wrong place, I thought I'd erase everything created after it, but find . -cnewer archive.7z gave the wrong results. So I made a controlled test by touching three ...
1
vote
1answer
100 views

In which directory is node running?

In trying to figure out how some application that listens on port 8088 is running, I see that it has PID 15020: $ netstat -ntulp Proto Recv-Q Send-Q Local Address Foreign Address ...
1
vote
1answer
501 views

Copy only files between two times [closed]

I'm trying to copy pictures taken between two times, from one directory to another. I’ve managed to list them using this command find /mnt -type f -name "*.jpg" -newermt "2014-12-14 01:00:00" ! -...
1
vote
2answers
107 views

How to limit the number of search results per directory

How to limit the number of search results per folder, for example: With this command: grep --include=*.php -Ril '<?' '/var/www/' I get the following: /var/www/test.php /var/www/test1.php /var/...
1
vote
1answer
287 views

How can I run a script recursively in a directory

I am using the following code to decode JPEG-compressed DICOMs. find ./* -maxdepth 0 -name '*.dcm' -printf 'dcmdjpeg %p %p \n' | sh I run this code inside any folder containing those files. The ...
1
vote
1answer
215 views

Replace cp function by rsync [duplicate]

I'm trying to replace my cp function by an rsync function My cp function is the following find /home/odroid/USBHD/Movies/ -iname "*.mkv" -mtime '-1' -exec cp -n {} /home/odroid/NASVD/Movies \; do ...
1
vote
2answers
394 views

run grep cmd recursively and print path name and result

I have a log file that exists in multiple directories one for each client. I am trying to run the following: find . -iname "20140926.log" -exec cat {} \; | grep 123456 | grep 'food="100"' | wc -l ...
1
vote
1answer
43 views

sliding window of JPGs from thousands of files

My machine has a camera attached that can take thousands of jpgs a day. I am looking for a way of remotely looking at the last 30 to 60 mins of footage via a cloud storage site such as box.com. I ...
1
vote
2answers
37 views

Deleting user directories with . in name

I have directories with usernames as "firstname.lastname" and firstname.middle.lastname in one directory. Is there a way to delete directories with "." in name under current directory. I need to run ...
1
vote
3answers
3k views

Bash script for automatic tar backup of chosen files and directories

Within a given directory in linux environment, I need to pick all files modified after a certain date (let's say 7 days) as well as all directories (only in root directory, hence non recursively) ...
1
vote
1answer
255 views

Running 'diff 'command after the 'find' command

I'm running this code on shell mv -f ~/sites/text1.txt ~/sites/text2.txt;find ~/sites/ -type f -exec sha1sum {} >> ~/sites/text.txt \;diff ~/sites/text1.txt ~/sites/text2.txt; However every ...
1
vote
1answer
677 views

Brace expression does not work in find regex

I have two folders, CA01 and CA02 under current folder, foo: foo -+ | +-CA01 | +-CA02 When I type find . -regex ".*CA[0-9]+" -exec echo {} + Or find . -regex ".*CA[0-9][0-9]"...
1
vote
1answer
314 views

Wrong behavior of xargs

I was trying to solve this issue using find + xargs but I stuck with another issue I am try to increasing a count using ((a++)) but not working . I have tried couple of combination of counting a ...
1
vote
2answers
2k views

Unix: find directory filenames listed in a text file and move to new directory

I'm a command line novice trying to figure out the appropriate command to execute the following within the Terminal in Mac OS X. Assuming I've placed all files in the same directory, I want to ...
1
vote
1answer
585 views

rename files matching specific mtime value within directory

I use simple set of shell commands to in order to create mysqldumps daily. The script is called by cron daemon. It looks like: presentdate="`date +%d-%m-%Y_%H:%M.%S`" basedir="/var/db_my_backup" ...
1
vote
3answers
998 views

Error in Script. Command find is skipping folders with space character

I need a script that counts the files in a directory (and sub). I've taken the followed script, and changed it to my need. It works like it should, except for folders with space characters. I'm ...
1
vote
1answer
110 views

Find alternative for Debian 5 to work with big files

I have a problem using find find ./ -mtime +7 Value too large for defined data type because of 2 Gb file (backup) on x32 VDS and it is not possible to reinstall OS. I need to remove old files ...
1
vote
1answer
458 views

How to create a cron which finds/kills/clears old puppet runs?

I am a new user of bash/cron, and I was given a task to create a cron which finds/kill/ and clears old puppet runs that were not successfully installed. The more help the better, but I am more or less ...
1
vote
1answer
61 views

How do I find and list folders with a specific folder name, containing files modified recently?

I have a set of folders that are regularly updated, which I would like to regularly parse through and update to a simple text file list. This list gets used with rsync so I shorten the file names ...
1
vote
0answers
28 views

Find recursively files that have a percentage of lines in common

Is possible to do this? I want an output where i have only files that are 50% the same of others or have 20+ lines in commons. I'm trying to isolate commons functions in *.java files. Thank you!
1
vote
0answers
41 views

Simple code reading issue [closed]

I'm studiyng Linux on a guide as a beginner, and there's a code example I cannot understand. I let you it below: find . -name "*.tmp" -exec rm {} \; by reading it, up to now I can understand that ...
1
vote
1answer
55 views

Extracting files to current directory

I want to find and tar/archive all my scripts ending .sh so I wrote something like that: touch ~/archive.tar; find ~ -type f -name '*.sh' -exec rvf ~/archive.tar {} \; The problem is that after I ...
1
vote
2answers
41 views

Finding files and directories with different umask

I have an umask as a 0002 using umask -S it returns u=rwx,g=rwx,o=rx. How do I find all files and directories that does not have rights set up according to mask? The directories goes 777 - mask and ...
1
vote
0answers
17 views

Find and redirect to capture pattern filename

I'm looking a way to do something like: find /path -name "201[2-6]*" | awk -F"/" '{print $5"/"$6"/"$7"/"$8",0,0,0"}' > archives_201\1.csv where archives_201\1.csv could be archives_201[2-6].csv ...
1
vote
3answers
57 views

How to find an ssh session a process was started from

How can I find a process which was started from some ssh session. For instance, I gave same ssh cridentials (aka. userzxc/passwordzxc) for my several friends which IPs i already know. My goal is to ...
1
vote
1answer
29 views

bash - isolating uppercase words

So, I have a directory containing around 50 directories having for name 3 letter uppercase words: AXC BCC EFC amongst other directories. I have already done a find to seek these 3 letter directories ...
1
vote
1answer
135 views

How to find files and act on them (find + exec)

I have downloaded about 3200 websites to the depth 2. So now I have one master folder (abc) that contains many folders, containing files for each website. So my folder abc contains 3200 folders and ...
1
vote
0answers
39 views

Copy file into all subdirectories that contains a file with certain name

I am trying to copy a features[30,55].R script from my desktop into all the subdirectories that contain a file whose name is DONE. I tried the following command: find . -name "DONE" -exec sh 'cp /...
1
vote
1answer
26 views

Find Source Files for OpenGL on Host

I am a newbie to linux. I just installed openGL on ubuntu and would like to tweak some of its source files I use in order to print certain results of some calculations done. I found the header file ...
1
vote
0answers
310 views

rsync only files newer than given date, with --delete

I'm trying to use rsync to backup only the files that have been created or changed after a certain date. The reason is that on that date, the whole system has been backed up. However, those global ...
1
vote
1answer
49 views

copying and working on OSX .app files (folders) in linux

tldr; I want to run a script over an external hard drive and tar.gz every folder that ends with .app into their own archive. That is, I don't want them all in one tar.gz file, I want to create one ...
1
vote
2answers
39 views

Rsync two “filepath” found by find commands [closed]

Original file /001day/backup/001m/name_test_v1.txt Destination file /001date/003m/name_test_v12.txt Method 1 rsync -av --progress /001day/backup/001m/ /001date/003m/ Method 2 ...
1
vote
1answer
20 views

How do I write a script to automatically compile and install all Moksha modules?

I have this repository cloned on my Sabayon machine, what I would like to do is write a script that will change into each directory of this repo (just the top-level directories, not directories inside ...
1
vote
0answers
56 views

Chaining grep commands [duplicate]

I'd like to find all xml files containing 'foo', but not containing 'bar'. The command I've put together looks like this: find -iname "*.xml" -print0 | xargs -0 grep -FlisZ "foo" | xargs -0 grep -...
1
vote
1answer
271 views

Find files older than a given file - a few hours

I'm using the following to find all files that are older than a reference file... find /home/testuser -name "dummyfiles*" ! -newer referencefile.txt ... which works as expected. However, I want to ...
1
vote
1answer
19 views

What changes are made to ./.dns?

My server hosted at Hostgator was recently hit by malware and hence to monitor the file system I use find -mmin -xx command at regular intervals. But everytime I run the find command, I see the first ...
1
vote
2answers
180 views

Find all .php files inside directories with writable permissions

I'm looking for a linux command to scan through all writable directories on the server and show ones with .php and .html files inside them. Something like: find -type d -writable -exec find {} -...
1
vote
0answers
80 views

Help with MKV to MP4 Remux script [closed]

Overview: I'm trying to remux my mostly MKV library to MP4. I have a script that has gone through and extracted subtitles from the video files. I have another script that will remux any .mkv files ...
1
vote
1answer
36 views

Pruning not working In find

find . \( -type f \) -o \( -name "*.rpm" -prune \) find . \( -name "*.sh" \) -o \( -name "*.rpm" -prune \) The second command excludes .rpm but the first one doesn't. What's the problem with ...
1
vote
0answers
41 views

What are the major differences between the Darwin/BSD and GNU versions of Findutils?

OS X comes with its own versions of find, locate, and xargs. GNU versions of these utilities are also available as part of GNU Findutils. What are the major differences between the two versions? Is ...
1
vote
1answer
59 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 ...
1
vote
1answer
199 views

Unzip specific files from multiple zip files

I'm new to Unix and am trying to extract specific pattern filename from the multiple zip files. I'm using find to find the zip files, and then trying to extract files having the filename CTL in the ...
1
vote
2answers
288 views

ls or find option to exclude binary files

How can I list only files that aren't compiled code in the current directory? I'm reviewing the custom scripts and code on several HPUX and Linux servers before transferring them to a newer system. ...
1
vote
0answers
69 views

What is SELinux's regex type?

I'm trying to locate all files on my system matching an SELinux file context (fcontext). These contexts are specified using some regex, and I'd like to use find -regex ... to the same effect. However, ...
1
vote
0answers
276 views

Using Rsync to SSH and Find files

Hello I am trying to use Rsync to SSH into a remote server and pull a certain type of file that has been modified within the last 24 hours. Here is what I am trying: rsync -avx --timeout=480 --...