Adb

Mis à jour le lundi 15 janvier 2024 par johackim

Adb est un outil pour gérer votre smartphone Android en ligne de commande depuis votre ordinateur.

Il vous permet de transférer des fichiers, de faire des captures d'écran, d'installer des applications, de faire des sauvegardes, de redémarrer votre téléphone, etc...

Installation

Pour l'installer sur Arch Linux :

sudo pacman -S android-tools

Pour l'installer sur Ubuntu :

sudo apt update && sudo apt install -y android-tools-adb

NOTE : N'oubliez pas de connecter votre smartphone et d'appuyer sur "Use USB to Transfer files" dans le centre de notifications.

Lister les périphériques

Pour lister les périphériques connectés :

adb devices

Se connecter à son smartphone

Pour vous connecter à votre smartphone :

adb shell

Copier des fichiers

Vous pouvez copier des fichiers depuis votre ordinateur vers votre smartphone et vice-versa :

adb push <path to file on computer> <location where you want to save file>
adb pull <path to file on device> <location where you want to save file>

Prendre un screencast

Pour prendre un screencast de votre smartphone :

adb shell
screenrecord <path/file.mp4>

Prendre un screenshot

Pour créer un screenshot de votre smartphone :

adb shell screencap <file.png>

Créer un backup

Pour faire une sauvegarde de votre smartphone :

adb backup -apk -shared -all

Cela va créer un fichier backup.ab que vous pouvez garder sur votre ordinateur.

Décrypter un backup

Pour décrypter et extraire un backup.ab, vous pouvez utiliser ce script Python :

wget https://raw.githubusercontent.com/lclevy/ab_decrypt/master/ab_decrypt.py
python ab_decrypt.py -b backup.ab -o backup.tar

Installer une application

Pour installer une application sur votre smartphone :

adb install <app.apk>

Redémarrer sur le bootloader

Si vous souhaitez changer de ROM, vous pouvez redémarrer sur le bootloader avec la commande suivante :

adb reboot bootloader

Références :