简体   繁体   English

如何使用adb shell列出android手机中的所有文件?

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

I just try to write a bash shell for my Android Phone. 我只是尝试为我的Android手机编写一个bash shell。
When I want list all the files in my Android Phone. 当我想列出我的Android手机中的所有文件。 I found that the Android shell terminal doesn't support find command. 我发现Android shell终端不支持find命令。
So I just want to know which is the best way to travel the sdcard files? 所以我只想知道哪个是旅行sdcard文件的最佳方式?

I might be wrong but "find -name __" works fine for me. 我可能错了,但“find -name __”对我来说很好。 (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. 您可能需要root权限。

Edit: As other answers suggest, use ls with grep like this: 编辑:正如其他答案所示,使用像grep这样的ls

adb shell ls -Ral yourDirectory | grep -i yourString

eg. 例如。

adb shell ls -Ral / | grep -i myfile

-i is for ignore-case. -i用于忽略大小写。 and / is the root directory. /是根目录。

Open cmd type adb shell then press enter. 打开cmd类型的adb shell然后按Enter键。 Type ls to view files list. 键入ls以查看文件列表。

just to add the full command: 只是添加完整的命令:

adb shell ls -R | grep filename

this is actually a pretty fast lookup on Android 这实际上是Android上非常快速的查找

This command will show also if the file is hidden adb shell ls -laR | grep filename 此命令还将显示文件是否隐藏adb shell ls -laR | grep filename adb shell ls -laR | grep filename

Some Android phones contain Busybox. 有些Android手机包含Busybox。 Was hard to find. 很难找到。

To see if busybox was around: 要查看busybox是否在附近:

ls -lR / | grep busybox

If you know it's around. 如果你知道它在附近。 You need some read/write space. 你需要一些读/写空间。 Try you flash drive, /sdcard 试试你的闪存驱动器/ SD卡

cd /sdcard
ls -lR / >lsoutput.txt

upload to your computer. 上传到您的计算机。 Upload the file. 上传文件。 Get some text editor. 获取一些文本编辑器。 Search for busybox. 搜索busybox。 Will see what directory the file was found in. 将查看找到该文件的目录。

busybox find /sdcard -iname 'python*'

to make busybox easier to access, you could: 为了使busybox更容易访问,您可以:

cd /sdcard
ln -s /where/ever/busybox/is  busybox
/sdcard/busybox find /sdcard -iname 'python*'

Or any other place you want. 或者你想要的任何其他地方。 R [R

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM