Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to list all the files in android phone by using adb shell?

Tags:

android

adb

I just try to write a bash shell for my Android Phone.
When I want list all the files in my Android Phone. I found that the Android shell terminal doesn't support find command.
So I just want to know which is the best way to travel the sdcard files?

like image 284
friddle Avatar asked May 28 '13 15:05

friddle


People also ask

How do I get adb devices list?

Go back to Settings -> Developer options -> turn on USB debugging. Go back to your terminal adb devices and you should see the connected device. Hope that helps.

How do I access adb shell on Android?

To use ADB with your Android device, you must enable a feature called “USB Debugging.” Open your phone's app drawer, tap the Settings icon, and select “About Phone”. Scroll all the way down and tap the “Build Number” item seven times. You should get a message saying you are now a developer.


2 Answers

I might be wrong but "find -name __" works fine for me. (Maybe it's just my phone.) If you just want to list all files, you can try

adb shell ls -R / 

You probably need the root permission though.

Edit: As other answers suggest, use ls with grep like this:

adb shell ls -Ral yourDirectory | grep -i yourString 

eg.

adb shell ls -Ral / | grep -i myfile 

-i is for ignore-case. and / is the root directory.

like image 199
pt2121 Avatar answered Nov 05 '22 20:11

pt2121


Open cmd type adb shell then press enter. Type ls to view files list.

like image 33
fauzi Avatar answered Nov 05 '22 19:11

fauzi