Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*"
Favorites infavorites:mine
Status closed:yes
Types is:question
Exclude -[tag]
For more details on advanced search visit our help page
Results tagged with Search options user 4194

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

Those messages are sent to stderr, and pretty much only those messages are generally seen on that output stream. You can close it or redirect it on the command-line. $ find / -name netcdf 2>&- or … $ find / -name netcdf 2>/dev/null Also, if you are going to search the root directory (/), then it is often good to nice the process so find doesn't consume all the resources. $ nice find / -name …
answered Aug 26 '11 by Arcege
What I believe you likely want is something more like: find . -not -name . -type d -prune -mtime +31 This will list the immediate directories in current directory older than 31 days. Adding the …
answered Jan 30 '13 by Arcege
The easiest way that I've found to do it is to pipe into something else to generate commands, like sed, then execute the commands in sh. find . -name '*\?*.mp4' -print | sed 's/.*/"&";h;y/?/_/;x;G;s … /\n/ /;s/^/mv /' | sh -s The find is pretty self-explanatory, as is the sh. The sed command may take a little explanation: s/.*/"&"/ surrounds the input with double quotes to handle any …
answered Jun 20 '15 by Arcege
The recursive grep will scan the entire tree and not care about directory structure. You need to traverse the structure and grep each directory individually. find /var/www -type d -print | while …
answered Nov 30 '14 by Arcege
Using find is the 'right' way, and the only programmatic way, although there are variations: find . -type f -exec chmod ug+rw {} + # "+" may not be on all systems or find . -type f -print0 … | xargs -r0 chmod ug+rw # similar to the -exec + functionality or the slowest: find . -type f -exec chmod ug+rw {} \; # in case xargs is not installed Each of these selects a file (not directory …
answered Sep 1 '11 by Arcege
It is a slightly long, but it is a single command-line. This looks at the contents of the files and compares them using a cryptographic hash (md5sum). find . -type f -exec md5sum {} + | sort | sed … 's/ */!/1' | awk -F\| 'BEGIN{first=1}{if($1==lastid){if(first){first=0;print lastid, lastfile}print$1, $2} else first=1; lastid=$1;lastfile=$2}' As I said, this is a little long... The find runs …
answered Nov 29 '14 by Arcege
Building on Chris Card's answer, I myself use: find . -print0 | xargs -r0 grep -H searched_string The -print0 combined with -0 in xargs ensures that whitespace in filenames is handled properly. The … -r tells xargs to give at least one filename on the command-line. I also generally use fgrep if I want fixed strings (no regular expression), which is a little faster. Using find . -print0 | xargs …
answered Dec 5 '11 by Arcege
I'd get rid of the grep and use awk: find $path -type f -print0 | xargs -0 awk "/$pattern/{print FILENAME,FNR}" But using grep and cut: find $path -type f -print0 | xargs -0 grep -nH "$pattern … socket when another program is supposed to be, then you might mess up that program. The find ... -print0 | xargs -0 gets around having whitespace in the filenames. It is not available on every UNIX system, but is on most. …
answered Nov 30 '11 by Arcege
You should be using -type and not -xtype: -xtype c The same as -type unless the file is a symbolic link. For sym‐ bolic links: if the -H or -P option was specified, true if …
answered Oct 4 '11 by Arcege
Some versions of sort have a -z option, which allows for null-terminated records. find folder1 folder2 -name "*.txt" -print0 | sort -z | xargs -r0 myCommand Additionally, you could also write a … high-level script to do it: find folder1 folder2 -name "*.txt" -print0 | python -c 'import sys; sys.stdout.write("\0".join(sorted("\0"))))' | xargs -r0 myCommand Add the -r option to xargs to make sure that myCommand is called with an argument. …
answered Mar 16 '12 by Arcege
Sounds like there is no file matching sftp_bcs_report_*.log in the starting directory on the second machine and more than one such file on the first server. For using find, patterns should always be quoted. …
answered Mar 28 '12 by Arcege
As @hknik says, the -mtime operation on find is likely your best bet, but if you want to get all files around three months ago, then you need a bigger net: find . -type f -mtime -105 -mtime +77 … This will find the regular files in the month surrounding three months ago, between 11 and 15 weeks ago. …
answered Mar 9 '12 by Arcege
I generally use: find . -type f -print0 | xargs -r0 du -a Xargs usually calls the command, even if there are no arguments passed; xargs du </dev/null will still be called, xargs -r du </dev/null …
answered Oct 11 '11 by Arcege
You can use xargs to get what you want. find . -type f -print0 | sort -z | xargs -0 -n1 openssl sha512 The -n1 option tells xargs to only allow one argument to be given to the openssl command …
answered Nov 25 '12 by Arcege