📁 基础目录导航
进入设备环境
adb shell
pwd
cd /storage/emulated/0
cd /
cd ..
🔍 查看文件列表
ls
ls -l
ls -a
ls -la
ls -lh
ls -lt
ls -lS
🔍 文件查找操作
按文件名查找
adb shell find /storage/emulated/0-name "DCIM"
adb shell find /storage/emulated/0 -name "*DCIM*"
adb shell find /storage/emulated/0 -name "*.jpg"
adb shell find /storage/emulated/0 -name "DCIM*"
按文件大小查找
adb shell find /storage/emulated/0 -size +10M
adb shell find /storage/emulated/0 -size -1M
adb shell find /storage/emulated/0 -size +100M
按文件类型查找
adb shell find /storage/emulated/0 -type f
adb shell find /storage/emulated/0 -type d
按修改时间查找
adb shell find /storage/emulated/0 -mtime -1
adb shell find /storage/emulated/0 -mtime +7
📊 目录大小统计
查看目录占用空间
adb shell du -sh /storage/emulated/0
存储使用情况
adb shell df -h /storage/emulated/0
📝 文件内容操作
查看文件内容
adb shell cat /storage/emulated/0/config.txt
adb shell head -10 /storage/emulated/0/app.log
adb shell tail -10 /storage/emulated/0/app.log
adb shell tail -f /storage/emulated/0/app.log
搜索文件内容
adb shell grep "error" /storage/emulated/0/app.log
adb shell grep -i "ERROR" /storage/emulated/0/app.log
adb shell grep -n "crash" /storage/emulated/0/app.log
adb shell grep -A 5 "exception" /storage/emulated/0/app.log
🛠️ 文件管理操作
创建目录
adb shell mkdir /storage/emulated/0/test
adb shell mkdir -p /storage/emulated/0/app/logs/crash
删除文件和目录
adb shell rm /storage/emulated/0/temp.txt
adb shell rm -r /storage/emulated/0/temp_folder
adb shell rm -rf /storage/emulated/0/cache/*
adb shell rm -f /storage/emulated/0/*.tmp
复制和移动
adb shell cp /storage/emulated/0/source.txt /storage/emulated/0/backup.txt
adb shell cp -r /storage/emulated/0/source/ /storage/emulated/0/backup/
adb shell mv /storage/emulated/0/old.txt /storage/emulated/0/new.txt
📱 应用数据操作
查看应用信息
adb shell pm path com.example.app
adb shell pm list packages | grep example
访问应用私有数据(仅debug应用)
adb shell run-as com.example.app ls -la
adb shell run-as com.example.app ls -la databases/
adb shell run-as com.example.app ls -la shared_prefs/
🎯 核心目录结构
Android文件系统
├── /sdcard/
│ ├── DCIM/
│ ├── Download/
│ ├── Pictures/
│ └── Android/data/
├── /data/data/
│ └── com.package/
│ ├── databases/
│ ├── shared_prefs/
│ ├── files/
│ └── cache/
├── /system/app/
└── /data/app/