List all Android phone files using ADB shell
In this article
Yes, you can list every file on an Android phone with ADB shell by opening a shell session and running the appropriate ls or find command. The process requires a computer with the Android Debug Bridge (ADB) installed, a USB cable, and USB debugging enabled on the device.
What You'll Need
- A computer running Windows, macOS, or Linux with the Android SDK Platform‑Tools package installed (this provides the
adbexecutable). - A USB cable that can transfer data, not just charge.
- Your Android phone or tablet with Developer options > USB debugging turned on.
- An optional terminal or command‑prompt window you are comfortable using.
Step‑by‑Step
- Install the Platform‑Tools. Download the official package from developer.android.com, extract it, and add the folder to your system
PATHor keep note of its location. - Enable USB debugging on the device. Open
Settings→About phoneand tapBuild numberseven times to unlock Developer options. Then go toSettings→System→Developer optionsand toggle USB debugging on. A confirmation dialog will appear; tap OK. - Connect the phone to the computer. Use the data‑capable USB cable. When prompted on the phone, choose File Transfer (MTP) or USB for debugging and accept the RSA key fingerprint if it appears.
- Verify the connection. Open a terminal (Windows Command Prompt, PowerShell, macOS Terminal, or Linux shell) and run:
adb devices
You should see a line with your device’s serial number followed bydevice. If it saysunauthorized, check the phone screen for the RSA prompt and approve it. - Start an ADB shell session. Type:
adb shell
You are now inside the device’s Linux shell, indicated by a#or$prompt. - Navigate to the directory you want to list. The most common starting points are:
/sdcard– internal shared storage visible to the user./storage/emulated/0– another view of internal storage./storage– contains mounted external SD cards and USB‑OTG volumes.
cd /sdcard
- Run the listing command. For a simple list of names:
ls
For a detailed view (permissions, size, timestamps):ls -l
To list hidden files as well, add the-aflag:ls -la
If you need a recursive list of every file on the device, use:ls -R /
For a more controlled output, especially on large partitions, thefindcommand works well:find / -type f
This prints the full path of each regular file. - Save the output to a file (optional). Redirect the command’s stdout to a temporary file on the device and then pull it to your computer:
find / -type f > /sdcard/filelist.txt adb pull /sdcard/filelist.txt .
You now havefilelist.txtin the current folder on your computer. - Exit the shell. Type
exitor press Ctrl+D.
Common Mistakes
- USB debugging not enabled. Without it,
adb deviceswill show no devices or list them asunauthorized. Double‑check the Developer options. - Using the wrong directory. Running
ls -R /from a non‑root shell will quickly hit permission‑denied errors on system folders. Stick to user‑accessible paths unless you have root access. - Forgetting the
-aflag. Hidden files (those beginning with a dot) are omitted by default, which can make the list appear incomplete. - Running the command on a locked device. Some manufacturers block shell access when the screen is locked; unlock the device first.
- Not quoting paths with spaces. If you navigate to a folder that contains spaces, use quotes, e.g.,
cd "/storage/USB Drive".
Tips
- Use
ls -lhto display file sizes in human‑readable units (KB, MB, GB). - Combine
findwith-nameto filter by extension, e.g.,find /sdcard -type f -name "*.pdf". - If you have root access (via a custom recovery or a rooted ROM), prepend
su -cto run commands as the superuser, e.g.,adb shell su -c "ls -R /". - Pipe the output through
sortorgrepfor easier analysis, such asfind /sdcard -type f | grep "\.jpg$". - When dealing with very large file systems, redirecting to a file first (as shown in step 9) prevents the terminal from freezing due to massive on‑screen output.
Troubleshooting
- Device not listed after
adb devices. Try unplugging and re‑plugging the USB cable, use a different port, or restart the ADB server withadb kill-server && adb start-server. Also verify that the correct USB mode (File Transfer or USB debugging) is selected on the phone. - “permission denied” when running
lson certain directories. This is expected for system folders on a non‑rooted device. Limit the command to user‑accessible locations or obtain root access if you truly need system‑level listings. - “command not found: find” on older Android versions. The
findbinary may be missing. In that case, rely onls -Ror install a small utility viaadb pushif you have the appropriate permissions. - Output truncates or appears garbled. Use the
-Rflag withlssparingly; instead, write to a file and pull it, as described in step 9. This avoids terminal buffer limits. - RSA key prompt never appears. On some devices you must first revoke previous USB debugging authorizations (Settings → Developer options → Revoke USB debugging authorizations) and then reconnect.
Frequently Asked Questions
How can I list hidden files on the device?
Include the -a option with ls (e.g., ls -la) or use find, which lists all files regardless of naming.
Can I list files on an external SD card?
Yes. First locate the mount point, usually something like /storage/XXXX-YYYY. Then run ls -R /storage/XXXX-YYYY or find /storage/XXXX-YYYY -type f.
Do I need root access to list every file?
Root is required only for system directories that are not world‑readable. User‑visible storage (/sdcard, /storage/emulated/0) can be listed without root.
How do I save the file list to my PC without pulling a temporary file?
You can pipe the output directly over ADB, for example:adb shell "find /sdcard -type f" > filelist.txt. This runs the command on the device and writes the result straight to a local file.
Is there a way to filter the list by file type?
Use find with the -name pattern, such as find /sdcard -type f -name "*.mp3". You can also pipe ls output to grep, e.g., ls -R /sdcard | grep "\.png$".
What if the phone shows “unauthorized” after I enable USB debugging?
Check the phone for the RSA fingerprint dialog and tap “Allow”. If it never appears, revoke previous authorizations in Developer options, disconnect and reconnect the cable, then try again.