Is there an adb command similar to "locate" or "grep" that would help me find a file on my Android device?

I'm curious about adb specifically, not a search app.

EDIT: "find" has been suggested, but on my ICS device:

hydrangea@turnsole:~$ adb shell find / -name *maps*
/system/bin/sh: find: not found

On my Gingerbread device it works, though. (Except I haven't rooted that device so it lacks permission.)

hydrangea@turnsole:~$ adb shell find / -name *maps*
find: permission denied
| improve this question | | | | |
  • Busybox will provide grep but not locate (AFAIK). – eldarerathis Feb 29 '12 at 22:40
  • 1
    find is available on stock devices I believe too. – Ryan Conrad Feb 29 '12 at 22:52
  • 2
    On ICS at least it tells me "find: not found". :( – Hydrangea Feb 29 '12 at 23:53

The find command works well in adb shell. The syntax is find /path -name file_name. For searching read only areas you will need root. If the find command is not available on your particular device, you might need to install BusyBox (search the Market.)

For example,
adb shell find / -name *maps*
will find all files that contain word "maps" across the entire file system.

| improve this answer | | | | |
  • 4
    If this command spams you with /somedir/: Permission denied append 2>/dev/null to the command to mute error messages. – onik Mar 1 '12 at 12:38
  • 1
    find -> /system/bin/sh: find: not found — out of luck. How do I install find onto a borked device which manufacturer decided to not include find into firmware? – Display Name Jan 18 '16 at 7:42

find utility come with BusyBox or another 3rd parts.

To use native capabilities try (ls -R on android, grep on PC):

adb shell ls -lR / | grep 'REGEX'
| improve this answer | | | | |

"find" is a command line application which might be normally installed as: 1. a binary executable (most desktop machines) or 2. something small doing many things where one of them is "find" or 3. might be not available as phone manufacturers don't like users to have too much control over their phones

Most likely you have one branded (ex. samsung) ICS device - manufacturers want to have more control on the device than owner does. Gain root there, then install busybox. Device is most likely something called "/system/bin/toolbox" - you could execute "/system/bin/toolbox find" but it is likely to return "no such tool" since manufacturer intentionally removed it from the device.

It is however possible that your device has the feature within its bundled toolbox - but just not "symlinked"... if "/system/bin/toolbox find" would execute the feature then you might use "ln /system/bin/find toolbox" command (I might have messed the order of params). Before executing "ln ..." you must remount device in read-write mode (either by using "adb root" or "su;mount -o remount,rw /system"

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.