I'm trying to search through the files and directories of a specific folder. For example, I was looking in /usr/bin for my python binaries. To do so, I used ls | grep python. When I did this, I was able to find, for example, python3, python3-config, etc. While this works fine, I know that there are  easier ways to do that: I shouldn't have to pipe to grep. But when I tried find . -name python, as per my understanding of the find man page, it yielded no results. I know that grep searches through a file. What is the correct way to search through a given directory?
124182
I want to list all the files, in directory I am currently in, with for example &quot;a&quot; in their name. I know that the first part of the command would be ls -l, but i do not know how to finish it.
101438
In unix server grep -r option is not working. OS is HP-UX.  If grep -r is not working any alternative way to do recursive search without -r option?
94520
I know there is a find switch. but I want to know how to search a specific type of file. For example I need kind of terminal command which search for only executable files.
104364
The command  $ find ~ -name .DS_Store -ls -delete   works on Mac OS X, but  $ find ~ -name __pycache__ -type d -ls -delete   does not - the directories are found but not deleted.  Why?  PS. I know I can do   $ find ~ -name __pycache__ -type d -ls -exec rm -rv {} +   the question is why find -delete does not work.
31808
I often have to do a recursive search in files. Tired of typing the whole "find/grep" combination all the time, I just created a script with the following line:  find . -name $1 -exec grep $2 {} + 2&gt;/dev/null   The idea is that I should be able to run it as, for example:  myfind '*' hello   The problem is, when '*' gets passed into the script, the script is expanding it to each file in the directory.  I tried putting a quote around $1:   find . -name '$1' -exec grep $2 {} + 2&gt;/dev/null   However, this turns $1 into a literal string.  Would appreciate your help in finding the right syntax. Must be something simple that I am missing.
29342
Within a set of directories, how do I find a file whose name includes a given string, such as "abcde"?
55783
I am trying to run grep against a list of a few hundred files:  $ head -n 3 &lt;(cat files.txt) admin.php ajax/accept.php ajax/add_note.php   However, even though I am grepping for a string that I know is found in the files, the following does not search the files:  $ grep -i 'foo' &lt;(cat files.txt)  $ grep -i 'foo' admin.php The foo was found   I am familiar with the -f flag which will read the patterns from a file. But how to read the input files?  I had considered the horrible workaround of copying the files to a temporary directory as cp seems to support the &lt;(cat files.txt) format, and from there grepping the files. Shirley there is a better way.
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?
48268
I have some simple python code that searches files for a string e.g. path=c:\path, where the c:\path part may vary. The current code is:  def find_path(i_file):     lines = open(i_file).readlines()     for line in lines:         if line.startswith("Path="):             return # what to do here in order to get line content after "Path=" ?   What is a simple way to get the text after Path=?
40225
I am searching for files which name which contain AAA within their path using following command:  find path_A -name "*AAA*"   Given the output showed by the above command, I want to move those files into another path, say path_B. Instead of moving those file one by one, can I  optimize the command by moving those files right after the find command?
39279
When I type something like:  find . -name *foo* | ls -lah   it returns the same result as a plain ls command, as though it had no input.  However:  ls -lah $( find . -name *foo* )   works well, but only when the find command has results.  Is it possible to pipe to ls ?
116705
I need to search for files starting with some particular name. There can be multiple files starting with a particular pattern and I want to list all such files present in the directory.
86509
I am trying to find data from files using grep, but grep usually prints out the filename as well as the line where the term is found.  In this case, I am looking for a special regexp and I want grep to print all items matching the regexp, not the line or the filename. In other words, I want to see only the matched regular expression.
106453
I am supposed to use ls to find files that end in a certain letter, but it does not matter if the file has an extension or not.  For example, I want it to do this  &gt; ls test test.txt test.ascii other.txt  &gt; ls [something] test test.txt test.ascii  So that I can find files that end with a 't', but it doesn't include the file where the extension ends in t  Edit: I am supposed to assume that the only period characters in the filename will be for the extension and there will be no others
28963
I thought this would be simple - but it is proving more complex than I expected.  I want to iterate through all the files of a particular type in a directory, so I write this:  #!/bin/bash  for fname in *.zip ; do    echo current file is ${fname} done   This works as long as there is at least one matching file in the directory. However if there are no matching files, I get this:  current file is *.zip   I then tried:  #!/bin/bash  FILES=`ls *.zip` for fname in "${FILES}" ; do     echo current file is ${fname} done   While the body of the loop does not execute when there are no files, I get an error from ls:  ls: *.zip: No such file or directory   How do I write a loop which cleanly handles no matching files?
116068
I would like to list the files recursively and uniquely that contain the given word.   Example: Checking for word 'check', I normal do is a grep  $ grep check * -R   But as there are many occurrence of this word, I get a lot of output. So I just need to list the filenames that contain the given search word. I guess some trick with find and xargs would suffice here, but not sure.  Any ideas?
61685
I'd like to find the files in the current directory that contain the text "chrome".  $ find . -exec grep chrome find: missing argument to `-exec'   What am I doing wrong?