我只是尝试为我的 Android 手机编写一个 bash shell。
当我想列出 Android 手机中的所有文件时。我发现Android shell终端不支持
find
命令。sdcard
文件的最佳方式?
我可能是错的,但“find -name __”对我来说效果很好。 (也许这只是我的手机。) 如果你只想列出所有文件,你可以尝试
adb shell ls -R /
不过你可能需要 root 权限。
编辑: 正如其他答案所建议的,将
ls
与 grep
一起使用,如下所示:
adb shell ls -Ral yourDirectory | grep -i yourString
例如。
adb shell ls -Ral / | grep -i myfile
-i
用于忽略大小写。 和 /
是根目录。
打开cmd输入
adb shell
然后按回车键。
输入 ls
查看文件列表。
只需添加完整命令:
adb shell ls -R | grep filename
这实际上是 Android 上相当快的查找速度
此命令还将显示文件是否隐藏
adb shell ls -laR | grep filename
某些 Android 手机包含 Busybox。很难找到。
查看 busybox 是否在附近:
ls -lR / | grep busybox
如果你知道它就在附近。您需要一些读/写空间。尝试使用闪存驱动器,/sdcard
cd /sdcard
ls -lR / >lsoutput.txt
上传到您的计算机。上传文件。获取一些文本编辑器。搜索 busybox。将查看在哪个目录中找到该文件。
busybox find /sdcard -iname 'python*'
为了使 busybox 更易于访问,您可以:
cd /sdcard
ln -s /where/ever/busybox/is busybox
/sdcard/busybox find /sdcard -iname 'python*'
或者您想要的任何其他地方。 R
我正在与
合作Android Debug Bridge version 1.0.41
Version 34.0.5-10900879
在 Win 10 上的 powershell 中,连接到 Pixel 7 / Android 14。 您现在必须引用 shell 输入:
adb shell 'ls storage/emulated/0/ | wc'