find . -name *.jks -print 2&gt;/dev/null   returns files of extension jks that do not have underscores as part of their name.  Much to my surprise, I have just discovered that * does NOT substitute the underscore.  find . -name *_*.jks -print 2&gt;/dev/null   returns files of extension jks that have one underscore.  How do I search for files that have 0 or more underscores?  Using OSX Mountain Lion.
47242
I am running the following command, but it is not performed recursively:  find . -name *.java   I know there are java files further down in the current directory but it is performing the find on the current directory only. I am using OS X, 10.9.
31242
How to match the hidden files inside the given directories   for example   If I give the below command it's not giving the result of the hidden files,     du -b maybehere*/*   how to achieve this simple using a single command instead of using   du -b maybehere*/.* maybehere*/*   as I need to type maybehere twice.
111273
Sometimes, I need to check only the directories not files. Is there any option with the command ls? Or is there any utility for doing that?  EDIT: I'm using Mac OS X, and ls -d gives me . even though I have directories.
77643
Looking to find all files (recursively) which have an underscore in their file name and then delete them via command line.
24253
I'm a programmer, and I find Mac's QuickLook a really great feature for quickly becoming familiar with a particular code base.  Basically, I open up a Finder window in the directory where my code files are, I push the spacebar (to evoke QuickLook), and then I arrow key up/down/left/right through all the files and scroll within QuickLook as needed.  The problem that I run into are files with no extension and files with unknown extension.  How can I convince the Mac to attempt to QuickLook these files as text files (which they usually are).  Also, it's really nice how QuickLook automatically colors the code based upon the type of code it thinks it is.  How can I extend the types of code files that the Mac recognizes?  For instance, I want to be able to QuickLook the code in a *.html.erb file or a *.js.erb file.
59964
I can't for the life of me figure out how find with the test -name works.  I run find / -name *in and returns a bunch of results:  /sbin /sbin/sulogin /dev/stdin   to name a few.  It's as if it performed filename expansion, but that happens before the shell runs the command, so that can't be it. Also because I don't have any files in the current directory that match *in. Plus, single quoting *in yields the same results, which further supports that this can't be filename expansion.  The documentation leads me to believe that find with -name uses regular expressions, but the regex pattern *in doesn't match the results I showed above.  Can someone enlighten me?
91095
Suppose that I have a folder containing .txt, .pdf, and other files.  I would like to list the "other" files (i.e., files not having the extensions .txt or .pdf). Do you have any advice on how to do this?  I know how to list files not having a given extension.  For example, if I want to list all files except the .txt files, then either   find -not -iname "*.txt"   or   ls | grep -v '\.txt$' | column   seem to work.  But, how can I list everything except .txt files or .pdf files?  It seems that I need to use some sort of logical "or" in find or grep.
24442
sudo find / -name "*" | xargs grep -sn --color=auto "-j"   Above command returns below:  grep: invalid option -- 'j' Usage: grep [OPTION]... PATTERN [FILE]... Try `grep --help' for more information. ...   How do I search for string -j?
68748
Or I have to use ack or find for this?  Here's what I want. Say I have this dir structure:  dir/nesteddir/match.txt otherdir/nesteddir/match.txt   How do I exclude first nesteddir only? Is it even possible using grep?  Most obvious answer $ grep -r --exclude-dir="dir/nesteddir" "stringToFind" . doesn't seem to work, nor do any of my experiments with various --exclude-dir paths using globbing, leading ./, etc.   Reading man page and googling didn't help, the only mention of this usecase I found is this question:   It was concluded that this is bug introduced in grep 2.12, but I'm using latest version (2.16) and grep's bugtracker () doesn't mention anything related to --exclude-dir, so I guess either it was fixed or it's an intended behaviour.   Would be really nice to get some clarification.
37878
I somehow managed to create a file that doesn't seem to have a filename. I found some information regarding how to get more details of the file in the following   However, I tried some of the suggestions listed and can't seem to delete the file. I'm not sure what I did to create it, but it happened while trying to copy an xml file.   Some info on the file is as follows;  &gt; ls -lb total 296 -rw-r--r--   1 voyager  endeavor  137627 Jan 12 12:49 \177  &gt; file * :               XML document  &gt; ls -i  417777      I tried to find using the inum switch and then pipe that to rm as that seemed like the most foolproof way of getting rid of it. However, the example given at the bottom of the thread linked below failed for me. Example was:  &gt; find -inum 41777 -exec ls -al {} \; find: illegal option -- i find: [-H | -L] path-list predicate-list   so I tried using the path list first like the following, but that didn't work either:  &gt; find . -inum 41777 -exec ls -al {} \;   I'm not sure what the non-printable character \177 is or how I can pass that to an rm command, but I really want to make sure I don't mess up any other files/directories in my attempt to delete this file.
435
What concise command can I use to find all files that do NOT contain a text string?  I tried this (using -v to invert grep's parameters) with no luck:  find . -exec grep -v -l shared.php {} \;   Someone said this would work:  find . ! -exec grep -l shared.php {} \;   But it does not seem to work for me.   has this example:  find ./logs -size +1c  &gt; t._tmp while read filename do      grep -q "Process Complete" $filename      if [ $? -ne 0 ] ; then              echo $filename      fi done &lt; t._tmp rm -f t_tmp   But that's cumbersome and not at all concise.  ps: I know that grep -L * will do this, but how can I use the find command in combination with grep to excluded files is what I really want to know.  pss: Also I'm not sure how to have grep include subdirectories with the grep -L * syntax, but I still want to know how to use it with find :)
18704
I am using locate command.   I want to find all files that end with specific extension and have specific keyword in their name.  For example I want to find image such as this:          myImageFromSummer.jpg      I want to search by keyword "Summer" and extension ".jpg".  How would command look like for this task?
38564
Situation :  $ mkdir foo &amp;&amp; touch foo/.test $ cp foo/* . zsh: no matches found: foo/* (or bash : cp: cannot stat ‘foo/*’: No such file or directory)   I have a directory full of hidden folders and files. What is happening and what is the solution?
58268
In Java, given a java.net.URL or a String in the form of http://www.example.com/some/path/to/a/file.xml , what is the easiest way to get the file name, minus the extension? So, in this example, I'm looking for something that returns "file".   I can think of several ways to do this, but I'm looking for something that's easy to read and short.
29342
Within a set of directories, how do I find a file whose name includes a given string, such as "abcde"?
104573
Even when /tmp has no file called something, searching for it with find will return 0:    $ find /tmp -name something    $ echo $?   0   How can I get a non-zero exit status when find does not find anything?
73437
How can I get the filename from a file path in Ruby?  For example if I have a path of "C:\projects\blah.dll" and I just want the "blah".  Is there a LastIndexOf method in Ruby?