15

I used adb push lol.png /storage/sdcard0/ to push a test file to my Galaxy S6, and the file was transferred successfully while failed to show up in my Android File Transfer. This is probably due to the fact that S6 doesn't have sdcard0 directory.

I like to remove the file I transferred (and the sdcard0 directory I accidentally created. But I don't know how to list remote directory via ADB. Is that possible? And How?

26

Easy to do – as in any Linux system:

  1. Connect your device as usual
  2. log into it using adb shell
  3. use the ls command to list files in the current directory, and the cd command to change directories (i.e. walk the tree / navigate through directories)

For details on the commands, check for the corresponding Linux man pages – e.g. man ls and man cd.

Edit: If you're "afraid" of the command line, you can also use an ADB file manager (see here for examples).

  • No I want no graphic interface. I have a quick follow up question. The adb shell take you to the root? I ask because the ls command gives me a different directory from my root (viewing on the phone). Thanks. – Aero Windwalker Aug 6 '15 at 2:28
  • @AeroWang adb shell ls /. Like Izzy said, look at the manual for these commands. – Matthew Read Aug 6 '15 at 4:49
  • Where in the directory hierarchy you end up with adb shell often depends on device and/or ROM. To make sure where you are: cd / places you in the root. Always. – Izzy Aug 6 '15 at 17:59
0
adb shell su -c ls -R *

This will list all folders with their contents and their subfolders.

  • trying this i get /system/bin/sh: su: not found? – Matifou Sep 29 at 5:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.