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

learn more… | top users | synonyms

1
vote
2answers
39 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
52 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
128 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
38 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
246 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
46 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
37 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
242 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
152 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
72 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
34 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
40 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
56 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
194 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
244 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
64 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
253 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 --...
1
vote
2answers
84 views

How do I find/list all files on filesystem with a certain SELinux “fcontext”

I'm having trouble finding information on what command, presumably from setools, I should use to find all the files on my filesystem that are labeled by SELinux with a certain file-context (fcontext). ...
1
vote
0answers
131 views

trash and restore script - issue restoring

#!/bin/bash echo "Are you sure you want to move this file to the Recycle Bin?" "(Yes/No)" read ans case "$ans" in Yes) echo "$(readlink -f $1)" >> "$HOME/TrashLog" && mv "$1" "$...
1
vote
1answer
52 views

Different results OS X/Linux with “find PATH -mount \( -type f -o -type d \) -print0 | LC_ALL=C sort --zero-terminated > OUTPUT.txt”

this command is part of a script I use for comparing files: find test/ -mount \( -type f -o -type d \) -print0 \ | LC_ALL=C sort --zero-terminated > OUTPUT.txt // test/ is the PATH OUTPUT....
1
vote
3answers
2k views

Print full pathname with `ls` and `find`

I want ls to print with absolute pathnames, how do I do that? find / -type d -mount -exec ls -ls {} \; ls is printing only the relative file names within the directory.
1
vote
3answers
157 views

How to enter foo-* folder without actually using wildcard or shell expansions?

Short story I'm looking for the command to enter first found foo-something directory like: cd foo-* but without using wildcard (or other special shell characters). Long story As part of the ...
1
vote
2answers
141 views

How to determine the newly closed file within a continuous audit log rotation?

I am attempting to find the best way to determine when the second file (of a matching criteria) is created. The context is an audit log rotation. Given a directory where audit logs are created every ...
1
vote
0answers
32 views

-exec isn't being passed all the files found by find [duplicate]

There are two files called install.log and install.sh The find command will find both of these and pass them to -exec ls With the addition of an or (-o), it only passes one argument to -exec ls ...
1
vote
5answers
70 views

find subdirectories with lowest number

I am trying to list all subdirectories with the lowest number. For example, for the following list: /100/2001 /100/2003 /101/2001 /101/2004 /102/2000 /102/2003 /102/2005 I am ...
1
vote
2answers
533 views

Find command for lookup up a directory tree

Is there any equivalent command, or options for, GNU find that will search up the directory tree? I'd like to look backwards through the tree for files with a given name. For example, say I'm in /...
1
vote
2answers
973 views

How to execute a builtin shell command using find?

I'm constrained to doing this in tcsh on CentOS due to the environment at work. When executing find . -type f -executable -exec source '{}' \; the only result is find: 'source': No such file or ...
1
vote
2answers
3k views

Find and move directories based on file type and date

I have a directory "New Movies" containing 200+ subdirectories "Movie Name (year)". The subdirectories "Movie Name (year)" contains a single video file (avi/mkv) and several related jpg/xml files. I ...
1
vote
1answer
1k views

find and exec: why does this command not work?

I don't get why echo prints empty line (latest cygwin version): ~/tmp >find mydor/ -name "*php" mydor/es/c/packags.php mydor/etns/inx.php mydor/pacepors.php mydor/XAE.php ~/tmp >find mydor/ -...
1
vote
0answers
40 views

find -exec {} vs. find -exec '{}' [duplicate]

I noticed in the man pages for find, that the {} always have single quotes around them. find -exec '{}' \; The description states: Notice that the braces are enclosed in single quote ...
1
vote
0answers
177 views

Find command incorrect results with days filter

I am trying to find all files modified before march 6 in a directory with thousands of files. I executed the following commands in the PWD where I want to find files. find -mtime +47 > /root/...
1
vote
0answers
67 views

GUI for find which can show video thumbnails

Is there a GUI for find (or just a graphical search tool which supports regex searches on filenames starting from a specific directory) which is able to show thumbnails found video and image files? I ...
1
vote
3answers
2k views

find with user variables

I am trying to call find with a few variables. So far I had this: DIRECTORY="./ " FILENAME=-regex" .*test.*" find $DIRECTORY $FILENAME Which works fine. If I change the filename to : FILENAME=-...
1
vote
2answers
141 views

Extracting a multiline regex without leading tabs

I've been trying to hack a little code extraction script together, but I can't get it to work. My goal is to examine all .txt files in a directory. If it contains a line which doesn't start with a ...
1
vote
1answer
201 views

Creating Cron Task to kill stalled/failed runs in a system

I was given a task to create a cron which finds, kills and clears old puppet runs that were not successfully installed. I am more or less looking for a starting point.
1
vote
0answers
92 views

How to search for file contents [duplicate]

Possible Duplicate: Finding a substring in files across subdirectories with a single built-in command? I know that I can use grep for a single file, but what about a whole directory tree?
0
votes
3answers
57 views

Grepping the output of find

I am looking for a folder, but there are a lot of Permission denied messages. I want to filter these out by grepping the output. I tried this, informed by other questions: find / -type d -name '...
0
votes
3answers
1k views

How to find files ending with ~ and pyc? [duplicate]

I want to find all files (in current and all subdirectory) which end in'~' or 'pyc'. To do so I have tried the following find pattern: find . -name '*{~,pyc}' find . -name '{*~,*.pyc}' but neither ...
0
votes
3answers
1k views

find -exec ls -lR {} \; returns every item twice

Background: I'm currently writing an archiving script, which creates gzipped tarballs from some folders and their contents. It should be able to synchronize the gzipped archives with the sources ...
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 ...
0
votes
5answers
171 views

Find all [filename].mp4 and rename [filename].audio [duplicate]

So I have a script that adds 2 films together using the audio from the $1.audio file. What I would like to do is rename any file in the directory with: *.mp4 To: *.audio Keeping original file ...
0
votes
2answers
8k views

How to use the find command in Perl script?

Could someone tell me why the find command always go to the root directory but not the directory that is specified in $srceDir? my $srceDir = "/mnt/SDrive/SV/Capture Data/"; my $find_cmd = 'find $...
0
votes
4answers
50 views

Print only directories with more than 31 files

I am using this script to count files on my directory and sub-directories: for i in $(find . -type d) ; do printf "$i %s\t" ; ( find $i -type f | wc -l ) ; done This script works fine. What I ...
0
votes
3answers
220 views

Is more or find more resource intensive in finding the number of times an item lists in a file?

I recently read How to find the total number of occurrences of text and files with find command, which asked about a way to find the number of times text "abc" appears in a file. The answer there ...