Questions tagged [find]

This tag has multiple meanings. Please DO NOT use this tag if you're just trying to find something.

find is:

  1. a filesystem search tool on various flavors of *nix,
  2. a filesystem search tool on various flavors of DOS and Windows,
  3. the name of a jQuery method,
  4. the name of a family of methods in ActiveRecord,
  5. a function in the C++ standard library,
  6. a method of strings in Python,
  7. a method of Matcher Class in Java.
  8. a method in many different NoSQL's to find documents in a collection.
10239 questions
6002
votes
52 answers

How do I find all files containing specific text on Linux?

I'm trying to find a way to scan my entire Linux system for all files containing a specific string of text. Just to clarify, I'm looking for text within the file, not in the file name. When I was looking up how to do this, I came across this…
Nathan
  • 65,860
  • 11
  • 32
  • 47
1610
votes
42 answers

How to exclude a directory in find . command

I'm trying to run a find command for all JavaScript files, but how do I exclude a specific directory? Here is the find code we're using. for file in $(find . -name '*.js') do java -jar config/yuicompressor-2.4.2.jar --type js $file -o $file done
helion3
  • 27,515
  • 13
  • 48
  • 91
826
votes
17 answers

How can I exclude all "permission denied" messages from "find"?

I need to hide all permission denied messages from: find . > files_and_folders I am experimenting when such message arises. I need to gather all folders and files, to which it does not arise. Is it possible to direct the permission levels to the…
Léo Léopold Hertz 준영
  • 119,377
  • 159
  • 417
  • 655
734
votes
16 answers

Does a "Find in project..." feature exist in Eclipse IDE?

Does Eclipse have a way to search a whole project for some text like Xcode's "find in project" feature?
William Jockusch
  • 26,421
  • 48
  • 170
  • 299
711
votes
11 answers

Python: Find in list

I have come across this: item = someSortOfSelection() if item in myList: doMySpecialFunction(item) but sometimes it does not work with all my items, as if they weren't recognized in the list (when it's a list of string). Is this the most…
Stephane Rolland
  • 34,892
  • 31
  • 111
  • 159
596
votes
7 answers

Find duplicate lines in a file and count how many time each line was duplicated?

Suppose I have a file similar to the following: 123 123 234 234 123 345 I would like to find how many times '123' was duplicated, how many times '234' was duplicated, etc. So ideally, the output would be like: 123 3 234 2 345 1
user839145
  • 6,023
  • 3
  • 13
  • 10
595
votes
16 answers

How do I find files that do not contain a given string pattern?

How do I find out the files in the current directory which do not contain the word foo (using grep)?
Senthil Kumar
  • 8,157
  • 7
  • 33
  • 44
535
votes
25 answers

ls command: how can I get a recursive full-path listing, one line per file?

How can I get ls to spit out a flat list of recursive one-per-line paths? For example, I just want a flat listing of files with their full…
dreftymac
  • 27,818
  • 25
  • 108
  • 169
499
votes
12 answers

find -exec with multiple commands

I am trying to use find -exec with multiple commands without any success. Does anybody know if commands such as the following are possible? find *.txt -exec echo "$(tail -1 '{}'),$(ls '{}')" \; Basically, I am trying to print the last line of each…
Andy
  • 4,999
  • 3
  • 13
  • 3
370
votes
12 answers

Using find to locate files that match one of multiple patterns

I was trying to get a list of all python and html files in a directory with the command find Documents -name "*.{py,html}". Then along came the man page: Braces within the pattern (‘{}’) are not considered to be special (that is, find . -name…
Xiong Chiamiov
  • 11,582
  • 8
  • 55
  • 95
345
votes
8 answers

jQuery: find element by text

Can anyone tell me if it's possible to find an element based on its content rather than by an id or class? I am attempting to find elements that don't have distinct classes or id's. (Then I then need to find that element's parent.)
sisko
  • 8,609
  • 18
  • 58
  • 121
344
votes
7 answers

How to use regex with find command?

I have some images named with generated uuid1 string. For example 81397018-b84a-11e0-9d2a-001b77dc0bed.jpg. I want to find out all these images using "find" command: find . -regex "[a-f0-9\-]\{36\}\.jpg". But it doesn't work. Something wrong with…
thoslin
  • 5,749
  • 6
  • 25
  • 28
328
votes
5 answers

Find a file by name in Visual Studio Code

How can I find a file by name in Visual Studio Code? A Visual Studio shortcut I'm used to is CTRL+,, but it does not work here.
Nenad
  • 19,511
  • 8
  • 58
  • 80
309
votes
12 answers

Make xargs handle filenames that contain spaces

$ ls *mp3 | xargs mplayer Playing Lemon. File not found: 'Lemon' Playing Tree.mp3. File not found: 'Tree.mp3' Exiting... (End of file) My command fails because the file "Lemon Tree.mp3" contains spaces and so xargs thinks it's two…
showkey
  • 449
  • 30
  • 101
  • 235
303
votes
6 answers

Find the files that have been changed in last 24 hours

E.g., a MySQL server is running on my Ubuntu machine. Some data has been changed during the last 24 hours. What (Linux) scripts can find the files that have been changed during the last 24 hours? Please list the file names, file sizes, and modified…
JackWM
  • 8,835
  • 18
  • 58
  • 90
1
2 3
99 100