49
votes
Accepted
How do I get my device detected by ADB on Linux?
Enable USB debugging on the device
This is done in Settings › Development. If you don't have that entry in your settings menu, go to Settings › About, scroll to the "Build number", and ...

Izzy♦
- 90.6k
43
votes
Is there a way to see the device's screen *live* on PC, through ADB?
screenrecord
screenrecord is an internal Android executable that dumps screen to a file, and ffplay from ffmpeg happens to be able to play an H.264 encoded stream from stdin
First enable ADB USB ...
41
votes
Accepted
How to use ADB to list remote directories?
Easy to do – as in any Linux system:
Connect your device as usual
log into it using adb shell
use the ls command to list files in the current directory, and the cd command to change directories (i.e. ...

Izzy♦
- 90.6k
35
votes
How to set WIFI proxy via adb shell?
On my Android 7 and 8 devices:
adb shell settings put global http_proxy <address>:<port>
Seems the setting is lost at reboot, however.
34
votes
Accepted
What is this `adb` utility I keep getting advice to use?
About adb
To put it shortly, adb (Android Debug Bridge) is a utility made to be installed on a computer, in order to let it gain a shell on a phone that's either connected via USB cable, or on the ...
33
votes
ADB backup creates 0-byte file; prompts for current backup password even though I never set one; "Failed to set password" for Desktop backup password
Short Answer
Try using an earlier version of adb. 1.0.32 did not work for me, but 1.0.31 did.
Long Answer
I just encountered this issue on a Nexus 5 running CyanogenMod 11 (based on Android 4.4) ...
32
votes
Accepted
Does adb backup/restore still work because it says it's deprecated?
Deprecated means it is fully functional but may be removed in future versions. Google of course prefers that their cloud is used so that they still control access to the backup data.
The only part ...
31
votes
How to find out currently running user name/ID from ADB
For Android 8, 9, 10, and possibly for Nougat too I suppose, run:
adb shell am get-current-user # returns USER_ID of the foreground user
adb shell cmd activity get-current-user # ...
30
votes
Is it possible to backup and restore an app with data via ADB?
The answer is: It depends. It's the way supposed to work:
adb backup -f myapp.ab -apk com.myapp # backup on one device
adb restore myapp.ab # restore to the same or any other device
...

Izzy♦
- 90.6k
28
votes
Samsung (Galaxy S4) does not show Authorize USB debugging dialog box
I have had this happen multiple times on multiple Android devices. Solved every time by putting the device in Photo transfer (PTP) mode.
ADB will not work for me when my device is in MTP or any other ...
27
votes
How can I shutdown my Android phone using an adb command?
Note: All the following commands below require root access.
On Android Oreo, this works and does a graceful shutdown:
adb shell su -c 'am start -a com.android.internal.intent.action.REQUEST_SHUTDOWN'
...
27
votes
Accepted
How to recover a deleted file from /data partition?
First to clarify root and data:
Root directory / of Android devices is a read-only pseudo (temporary) filesystem (rootfs) that lives in RAM and is vanished when device is powered off. When device is ...
25
votes
How to uninstall a system app using adb uninstall command (NOT remove via rm or any other way)
I succeded adding the -k and --user options to the pm command, e.g.:
pm uninstall -k --user 0 com.android.service
The command was issued as root, no need to remount /system as rw. Android on the ...
25
votes
Accepted
How to reinstall an uninstalled system app through ADB?
Technically, the command adb shell pm uninstall -k --user 0 <package_name> does not uninstall an app from the device. Instead, it just removes it from a user.
There are a couple of ways to get ...
22
votes
Why doesn't Huawei provide just the USB driver to use ADB?
Drivers are not distributed as standalone package in order to increase market penetration of the HiSuite software. It's quite popular marketing strategy: you can get what you want only in bundle with ...
19
votes
Enable location services via ADB or shell
On Android 6.0,
To enable:
GPS: adb shell settings put secure location_providers_allowed +gps
Network: adb shell settings put secure location_providers_allowed +network
To disable:
GPS: adb shell ...
19
votes
Enable and disable system apps via ADB
This should work regardless whether the app is a system app or a third-party app (user installed).
See my answer at Determine the package name of your app to get the package name of the concerned app ...
19
votes
Accepted
adb push not working on /system, read only
The sequence of commands that worked for me was
adb root
adb disable-verity
adb reboot
adb root
adb remount
If I don't reboot, remount does not succeed.
18
votes
Is there a way to backup contents of internal SD, while preserving the file's modification date?
Try using the -a option to copy all file attributes:
adb pull -p -a /sdcard/
(The -p is for progress indication.)
18
votes
how to adb wait-for-device until the home screen shows up?
This is an old question and borderline off-topic but here is how to do it in a single line:
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done; input keyevent ...
18
votes
Accepted
Can I enable USB debugging using adb?
I got it to work :)
NOTE: This requires unlocked bootloader.
Connect the device to Mac or PC in recovery mode. (I had to map the
process in my mind as the screen was broken).
Now open terminal/CMD ...
16
votes
Accepted
Using ADB to change the screen lock
Since Android 8.0 Oreo, you can change the lock screen using below adb commands
adb shell
athene_f:/ $ locksettings
usage: locksettings set-pattern [--old OLD_CREDENTIAL] NEW_PATTERN
...
16
votes
ADB backup creates 0-byte file; prompts for current backup password even though I never set one; "Failed to set password" for Desktop backup password
Building on kevenoid's answer, it may depend on what version of adb is running on the phone.
You can find out what version the phone is running natively by doing the following:
First find out what ...
16
votes
Accepted
Can't use chmod to alter permissions on emulated phone
Figured it out - seems like you just can't change permissions for files on sdcard. Moved it to data/local and chmod worked like a charm.
16
votes
Accepted
disconnect adb of device connected over TCP does not work
I just use "adb disconnect" and it worked fine for me. See the photo below:
16
votes
Factory reset Android using ADB
You need:
Minimal ADB & Fastboot which contains ADB executable then unzip the file
ADB drivers and install them
A computer
Steps:
Open the folder where Minimal ADB & Fastboot is, launch it.
...
16
votes
Accepted
Android O, failed to mount /system, /dev/block/dm-0 is read only
For debug build, user have to disable-verity at first.
adb root
adb disable-verity
adb reboot
adb remount
adb shell
mount -o rw,remount /system
In order to know build type of your android, in adb ...
15
votes
How to uninstall a system app using adb uninstall command (NOT remove via rm or any other way)
Also works without -k (keep user settings) option:
pm uninstall --user 0 com.android.service
and without opening adb shell:
adb uninstall --user 0 com.android.service
14
votes
Accepted
adb listing all forwarded ports
I think a new command has been added since the earlier answers:
adb forward --list
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
adb × 2296fastboot × 227
shell × 186
backup × 181
recovery-mode × 163
root-access × 142
usb-debugging × 120
rooting × 102
twrp × 100
linux × 95
usb × 87
applications × 79
cyanogenmod × 75
data-recovery × 72
broken-screen × 69
samsung × 68
bootloader × 65
command-line × 58
rom-flashing × 57
boot-loop × 57
usb-drivers × 56
restore × 53
windows × 51
wi-fi × 49
installation × 46