Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

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
share|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

2 Answers 2

"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"

share|improve this answer

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.

share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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