Adb commands over wifi
I find it usually hard to share files between an android phone and my laptop. Through the bluetooth, for some reasons, the connection seems unstable and downloading, for example, images from the phone to the laptop does not work very well.
An alternative is to connect to the phone over the wifi. To do so, you must enable the developper options of the android.
You also need the adb
tool on the laptop. On Ubuntu, it is available through apt :
$ sudo apt install adb
Then, on the phone, you go to the “Wireless debugging” menu and pair a device with a code. You see a pair of IP and port, as well a code. Keep this in mind.
On the laptop, you first pair your laptop with the device :
adb pair IP:PORT
with the right IP/PORT. And you should be asked the code. Once paired, you should see something like
$ adb pair 192.168.xx.xx:37159
Enter pairing code: 807200
* daemon not running; starting now at tcp:5037
* daemon started successfully
Successfully paired to 192.168.xx.xx:37159 [guid=....]
The next step is to connect to the device
$ adb connect 192.168.xx.xxx:38853
connected to 192.168.xx.xx:38853
Note the port may have changed but it is displayed on the android phone. Once connected, you can see the device with
$ adb devices
List of devices attached
192.168.1.121:38853 device
and you can now run commands on the phone like :
- listing the content of the storage looking for the photos :
$ adb shell ls /storage/emulated/0/DCIM/Camera
- pulling from the phone to the laptop some photos :
$ adb pull /storage/emulated/0/DCIM/Camera/IMG_20250903_091343.jpg
Or even running a shell on the phone
$ adb shell
Enjoy Reading This Article?
Here are some more articles you might like to read next: