646

I've just started using Android Studio (IntelliJ), and I now look for the feature to find the occurrence of a string in any of the files in my project. For example: I want to find all the files that contain the string ".getUuid()"

The search at the top right doesn't give me the correct results, and I don't think I can find this feature under Edit > Find.

Could anybody point me at the right direction?

Zoe
  • 27,060
  • 21
  • 118
  • 148
kramer65
  • 50,427
  • 120
  • 308
  • 488
  • 3
    I don't know if I understand your question, but if you want to find something in your file , push `Ctrl+R`. – Rick Nov 27 '13 at 20:28
  • 8
    @user2675569 - I don't want to find something in the file that I have open, I want to find it in all the files that are in the project. Any idea how I could do that? – kramer65 Nov 27 '13 at 20:33
  • to searc all in window is ctrl + h .. in mac is command + shift + f .. – MAS. John May 07 '17 at 04:58
  • if you want to export results to text file please see my answer : https://stackoverflow.com/a/61691027/3904109 – DragonFire May 09 '20 at 05:04

15 Answers15

861

TLDR: ⌃⇧F on MacOS will open "Find in path" dialog.

First of all, this IDEA has a nice "Find Usages" command. It can be found in the context menu, when the cursor is on some field, method, etc.

It's context-aware, and as far as I know, is the best way to find class, method or field usage.

Alternatively, you can use the

Edit > Find > Find in path…

dialog, which allows you to search the whole workspace.

Also in IDEA 13 there is an awesome "Search Everywhere" option, by default called by double Shift. It allows you to search in project, files, classes, settings, and so on.

Also you can search from Project Structure dialog with "Find in Path…". Just call it by right mouse button on concrete directory and the search will be scoped, only inside that directory and it's sub-directory.

Enjoy!

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Seagull
  • 13,484
  • 2
  • 33
  • 45
  • 163
    Command-Shift-F on Mac to find in path, I am guessing Ctrl-Shift-F for Windows? – Gerard Mar 28 '14 at 13:07
  • 1
    And Ctrl-Shift-R for replace. – Phlox Midas Jul 29 '14 at 20:56
  • Ctrl+Shift+F to find in path on MAC – stevo.mit Nov 22 '14 at 18:19
  • @stevo.mit nope, see the first comment with 17+ – Erik B Dec 05 '14 at 02:55
  • @Erik B Yes I saw it, but it didn't work for me. I did not customize shortcuts in my Android Studio and the shortcut is (at least on my Mac) Ctrl+Shift+F – stevo.mit Dec 05 '14 at 08:00
  • 3
    That's the exact reason, why I haven't included any shortcuts in answer. You can always check everything in keymap and change it. – Seagull Dec 05 '14 at 11:16
  • Maybe a "windows" keyboard and the command is mapped to ctrl? – Erik B Dec 05 '14 at 17:37
  • Ctrl+Shift+F for Linux – Kushal Jul 15 '15 at 05:45
  • TIP: make sure File Name Filter is according to your needs. I had it default to build.gradle and boom never nothing appropriate was found in the search..phew.. I need more tome to get used to Android Studio. – David Prun Sep 03 '15 at 21:06
  • 2
    If you are like me and use this all the time, you might want to set a simpler shortcut as well by going to Preferences --> Keymap --> Main Menu --> Edit --> Find --> Find in path... – Bitcoin Cash - ADA enthusiast Nov 03 '15 at 03:24
  • Studio also great features to filter out comments for example https://postimg.cc/image/axl41486j/ – user25 Jul 15 '18 at 17:46
  • Is there an option to replace all occurrences of a particular string? – Ilo Calistus Mar 28 '19 at 14:32
  • @calistus Yes. Action is called Replace in path, it' located right under the find action. – Seagull Mar 28 '19 at 17:28
  • 7
    Since Android Studio 4.0 the combination has changed -> the default combination is now on MAC OS X Catalina -> Control (^) + Shift + F. To get back the classic combination with command instead of control as start you need to edit the keyboard shortcuts in android studio's preferences. – LukeFilewalker May 29 '20 at 08:34
  • The `search everywhere` option finds nothing. – Mert Gülsoy Jun 09 '20 at 16:27
  • Does anyone know why this command is so fast? how can it find a character array in gigabyte project within milliseconds? @Kushal – CDM social medias in bio Apr 20 '22 at 18:14
  • @Maddocks Indexing. I'm not sure what and how exactly do they index, but if you are really curious, I'd recommend looking at Community Edition's source code for hints. [Here for example I can see a code doing text search using trigram indices](https://github.com/JetBrains/intellij-community/blob/master/platform/indexing-impl/src/com/intellij/find/ngrams/TrigramTextSearchService.java) – Seagull Apr 21 '22 at 15:35
181

In Android Studio on a Windows, macOS or Linux based machine use shortcut Ctrl + Shift + F to search any string in whole project. It's easy to remember considering Ctrl + F is used to search in the current file. So just press the Shift as well.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Jakub Michalko
  • 2,099
  • 1
  • 11
  • 12
  • Does not work if you set Eclipse key bindings. Ctrl + Shift + F is format. – Aniket Thakur Jul 18 '15 at 19:37
  • 1
    There are 13 options how to set key binding. Switch back to "Default" and it will work. Otherwise it is up to you to learn your setting. (FYI: it is Ctrl+H for "Eclipse" key binding) – Jakub Michalko Jul 20 '15 at 13:00
  • 1
    Can we find and replace all in a project too? – K.Sopheak Nov 22 '16 at 09:44
  • Any clue how to get the search window to then GO AWAY? Mine seems to be permanently on-screen and on top of things - I'm having to drag it around to see things behind it, as it seems to be too cool to have an X or exit option anywhere... oh, trying random keystrokes "worked"... apparently it's the ESC key to get it to go away. – Dronz Aug 27 '19 at 23:23
  • If you want to export the results into a text file then please see my answer https://stackoverflow.com/a/61691027/3904109 – DragonFire May 09 '20 at 05:06
67

Press Shift twice and a Search Everywhere dialog will appear.

nick
  • 18,784
  • 2
  • 24
  • 31
  • 36
    Strangely enough, it doesn't find every occurrence, but `Ctrl` + `shift` + `F` does. – Whitebird Apr 19 '15 at 13:06
  • @Whitebird Yeah, I'm not sure why. I tend to use Ctrl + Shift + F a lot more, even though the results aren't as pretty. – nick Apr 19 '15 at 18:22
  • Double `shift` can not search Chinese characters,but `Ctrl`+`shift`+`f` does – chinaanihchen Jun 11 '15 at 02:36
  • `Double Shift` search for non project things as well like settings. So as it does long works its time consuming. Try `Ctrl + Shift + F` if you want only things in project, its much faster than `Double Shift` – Inzimam Tariq IT Dec 10 '17 at 17:44
16

Use Ctrl + Shift + F combination for Windows and Linux to search everywhere, it shows preview also.

Use Ctrl + F combination for Windows and Linux to search in current file.

Use Shift + Shift (Double Tap Shift) combination for Windows and Linux to search Project File of Project.

rootmeanclaire
  • 808
  • 3
  • 13
  • 37
Jitesh Prajapati
  • 2,533
  • 4
  • 29
  • 51
16

You can open the Find in Path dialog by pressing:

Ctrl + Shift + F

Willi Mentzel
  • 27,862
  • 20
  • 113
  • 121
11

Android Studio Version 4.0.1 on Mac combination is for me:

Shift + Control + F

Alexander Belokon
  • 1,452
  • 2
  • 17
  • 37
10

Android Studio 3.3 seems to have changed the shortcut to search for all references (find in path) on macOS.

In order to do that you should use Ctrl + Shift + F now (instead of Command + Shift + F as wrote on the previous answers):

UPDATE

To replace in path just use Ctrl + Shift + R.

enter image description here

Filipe Brito
  • 5,329
  • 5
  • 32
  • 42
8

And for all of us who use Eclipse keymaps the shortcut is Ctrl+H. Expect limited options compared to eclipse or you will be disappointed.

Misha Akopov
  • 12,241
  • 27
  • 68
  • 82
JanPl
  • 794
  • 6
  • 19
7

In Android Studio on a Windows or Linux based machine use shortcut Ctrl + Shift + R to search and replace any string in the whole project.

Misha Akopov
  • 12,241
  • 27
  • 68
  • 82
Madhan M
  • 71
  • 1
  • 1
6

What you want to reach is that, I believe:

  • cmd + O for classes.
  • cmd + shift + O for files.
  • cmd + alt + O for symbols. "wonderful shortcut!"

Besides shift + cmd + f for find in path && double shift to search anywhere. Play with those and you will know what satisfy your need.

Misha Akopov
  • 12,241
  • 27
  • 68
  • 82
aselims
  • 1,843
  • 1
  • 17
  • 19
3

use ctrl + shift + f on windows

2

Press SHIFT 2 times and you can search Every-where , both Class and Method() in the project.

Ctrl + N for finding only Class name.

Ctrl + E for Recent Files.

Misha Akopov
  • 12,241
  • 27
  • 68
  • 82
rhaldar
  • 1,075
  • 10
  • 6
1

In Android 3.6 on a Mac if you want to export the results to a text file then do the following

Command+Shift+F then enter the text you want to search

Then on Bottom Right click on "Open In Find Window"

Then Right Click On Found Occurrences

Then Export To Text File

Once in text file you can find and replace to remove, sort lines etc... please see screenshots for assistance.

enter image description here

enter image description here

DragonFire
  • 3,722
  • 2
  • 38
  • 51
0

Use Ctrl + Alt + F combination in Ubuntu.

Ozgur
  • 3,738
  • 17
  • 34
0

On a mac use shift + cmmd + f

To get rid of the screen press esc

I use IntelliJ IDEA version: 2019.2.3 (Community Edition) Build #IC-192.6817.14, built on September 24, 2019 Runtime version: 11.0.4+10-b304.69 x86_64

Misha Akopov
  • 12,241
  • 27
  • 68
  • 82
Lance Samaria
  • 17,576
  • 18
  • 108
  • 256