# adb and fastboot must know Install [android SDK](https://developer.android.com/studio/index.html) (bottom of the page) or full [android studio](https://developer.android.com/studio/index.html) if you need to develop on android. `fastboot` looks like `adb` but it is used when device is in `bootloader` (*or fastboot*). ## Check connected devices ### adb: ```bash adb devices ``` ### fastboot ```bash fastboot devices ``` ## Reboot ### normal reboot ```bash adb reboot ``` ### bootloader reboot ```bash adb reboot bootloader ``` ```bash fastboot reboot-bootloader ``` ### recovery reboot ```bash adb reboot recovery ``` ## Unlock / erase / flash ### unlock bootloader ```bash fastboot oem unlock ``` > WARING: If you if you unlock the bootloader it will behave like a factory reset. So backup all your data before! ### lock bootloader ```bash fastboot oem lock ``` > WARNING: If you lock back the bootloader, next time you need to unlock data will still behave like a factory reset ### erase ```bash fastboot erase xxx ``` Erase partition xxx. Partition could be: - `boot`, - `cache`, - `recovery` - `system`, - `radio`, - `userdata`, - `bootloader` ### flash ```bash fastboot flash xxx yyy ``` Flash partition xxx with new yyy. For example: - flash bootloader with a new bootloaler image: ```bash fastboot flash bootloader new_bootloader.img ``` - flash radio with a new radio image: ```bash fastboot flash radio new_radio.img ``` ## File explorer ### Explore files (use linux commands) ```bash adb shell ``` ### copy files from computer to device ```bash adb push FILE /sdcard ``` Copy a file `FILE` to device's sdcard. ### copy files from device to computer ```bash adb pull FILE /some_computer_directory ``` Copy a file `FILE` to computer's directory ### remount ```bash adb remount ``` ### install apk ```bash adb install file_name.apk ``` ## Backup and Restore (NO ROOT NEEDED) ### backup When you launch a backup command a `password` for this backup will be asked. #### backup all (*simple*) ```bash adb backup -all ``` Note: backup `backup.ab` is placed inside `platform-tools` by default. #### backup parametized (*less simple but accurate*) ```bash adb backup -apk -shared -all -f computer_destination_directory\backup.ab ``` Parameters: - `-apk` OR `_noapk`: - include or not apk - `-shared` OR `-noshared`: - include or not files from `sdcard` - `-all` - Save system files and applications files (wihtout apk files) - `-f computer_destination_directory\backup.ab` - define a directory ### restore ```bash adb retore computer_source_directory\backup.ab ```