ADB and Fastboot commands

Instructions for setting up Adb/Fastboot (windows)

  1. On your phone, go to Settings > Developer Options and ensure USB debugging is ON. If Developer Options are not visible, go to Settings > About Phone and tap the Build Number 10 times. Then go back to Settings, and you will see Developer Options above About Phone. Click on Developer Options, then select USB debugging (also known as ADB debugging).
  2. Install drivers on your PC. Try using PDANet for the drivers. Install the program by clicking “Run” and following the instructions. You can remove it later if needed.
  3. Download the file at the bottom of these instructions to your desktop and extract the contents. You should see one folder and an install note (these instructions) after extraction. You can use a program called 7-ZIP to extract the files if needed (Google it, it’s free and a great tool).
  4. Open your Start menu and click on My Computer. Then choose Local Disk C:. Drag the adb folder you extracted to the C: drive.
  5. Open a command prompt and type cd\adb and hit enter. You should now see something like this: C:\adb>.
  6. Type adb devices and hit enter in the command prompt. It should list your device.
  7. You can also type adb reboot bootloader to put the device into bootloader mode. Now type fastboot devices and hit enter in the command prompt, and it should list your device. (You must be in the bootloader for fastboot to recognize your device.)

You should now be ready to send commands to your phone via ADB or Fastboot. You will need to repeat steps 5-6 anytime you want to use ADB/Fastboot. To send a file using ADB or Fastboot, make sure to place the file in your “adb” folder before issuing the command to send it to your device.

SCREEN RECORD ON ANDROID 4.4 KITKAT

adb shell screenrecord /sdcard/filename.mp4
Save the file to the device SDcard and press ctrl+c to stop recording.
Here is a video on a easy way to screen record. VIDEO
 
 
How to unlock your bootloader on the Nexus device using ADB/FASTBOOT
1.  Open a commandline window in your ADB folder by holding shift and right clicking mouse.
2.  Type adb devices then hit enter in the command prompt and it should list your device.
3.  Type adb reboot bootloader hit enter
4.  Type fastboot oem unlock hit enter
5,  Your tablet will then ask if you want to unlock.  Using the volume keys, highlight “Yes” and then press the power button to select it. Your bootloader will now be unlocked.  Choose to start your tablet and it will factory reset itself and reboot. You are now operating with an unlocked Nexus.
6.  Now that your nexus is unlocked you need to flash a recovery to it in ADB.
7.  Open a commandline window in your ADB folder by holding shift and right clicking mouse.
8.  Type adb devices then hit enter in the command prompt and it should list your device.
9.  Type adb reboot bootloader hit enter
10.  Type fastboot flash recovery (name of recovery.img) then hit enter. Make sure you put the recovery .IMG in the ADB folder on your computer.  I recommend twrp recovery.
 
 WHAT IS A LOGCAT

Logcat is the command to view the internal logs of the Android system. Viewing logs is often the best way to diagnose a problem, and is required for many issues. This way you’ll find out what apps are doing in the background without you noticing.

TAKING AN LOGCAT

Now type this in the terminal
adb devices (note) to make sure devices is connected
adb logcat -v long > logcat.txt
OR

adb logcat > logcat.txt:

 
you shall have a log file called name of problem.txt inside your ADB folder.  Now open the logcat.txt file and see whats your problem.
 
 

Here are some commands for Adb/Fastboot.
DO NOT USE ANY COMMANDS THAT YOU ARENT SURE OF OR DONT KNOW WHAT THEY DO. I AM NOT RESPONSABLE FOR ANYTHING THAT YOU DO TO YOUR PHONE.

ADB Commands Quote:

adb devices – list all connected devices
adb push <local> <remote> – copy file/dir to device
adb pull <remote> [<local>] – copy file/dir from device
adb sync [ <directory> ] – copy host->device only if changed
(-l means list but don’t copy)
(see ‘adb help all’)
adb shell – run remote shell interactively
adb shell <command> – run remote shell command
adb emu <command> – run emulator console command
adb logcat [ <filter-spec> ] – View device log
adb forward <local> <remote> – forward socket connections forward specs are one of: tcp:<port>
localabstract:<unix domain socket name>
localreserved:<unix domain socket name>
localfilesystem:<unix domain socket name>
dev:<character device name>
jdwp:<process pid> (remote only)
adb jdwp – list PIDs of processes hosting a JDWP transport
adb install [-l] [-r] [-s] <file> – push this package file to the device and install it
(‘-l’ means forward-lock the app)
(‘-r’ means reinstall the app, keeping its data)
(‘-s’ means install on SD card instead of internal storage)
adb uninstall [-k] <package> – remove this app package from the device
(‘-k’ means keep the data and cache directories)
adb bugreport – return all information from the device
that should be included in a bug report.
adb help – show this help message
adb version – show version num
DATAOPTS:
(no option) – don’t touch the data partition
-w – wipe the data partition
-d – flash the data partition
scripting:
adb wait-for-device – block until device is online
adb start-server – ensure that there is a server running
adb kill-server – kill the server if it is running
adb get-state – prints: offline | bootloader | device
adb get-serialno – prints: <serial-number>
adb status-window – continuously print device status for a specified device
adb remount – remounts the /system partition on the device read-write
adb reboot [bootloader|recovery] – reboots the device, optionally into the bootloader or recovery program
adb reboot-bootloader – reboots the device into the bootloader
adb root – restarts the adbd daemon with root permissions
adb usb – restarts the adbd daemon listening on USB
adb tcpip <port> – restarts the adbd daemon listening on TCP on the specified port
networking:
adb ppp <tty> [parameters] – Run PPP over USB.
Note: you should not automatically start a PPP connection.
< tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1
[parameters] – Eg. defaultroute debug dump local notty usepeerdns
adb sync notes: adb sync [ <directory> ]
< localdir> can be interpreted in several ways:
– If <directory> is not specified, both /system and /data partitions will be updated.
– If it is “system” or “data”, only the corresponding partition is updated.environmental variables:
ADB_TRACE – Print debug information. A comma separated list of the following values
1 or all, adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp
ANDROID_SERIAL – The serial number to connect to. -s takes priority over this if given.
ANDROID_LOG_TAGS – When used with the logcat option, only these debug tags are printed

Fastboot Commands Quote: Example (fastboot flash recovery TWRP-recovery.img) then hit enter this will flash a recovery image to the device.

usage: fastboot [OPTION…] COMMAND…

flashing:
update ZIP Flash all partitions from an update.zip package.
flashall Flash all partitions from $ANDROID_PRODUCT_OUT.
On A/B devices, flashed slot is set as active.
Secondary images may be flashed to inactive slot.
flash PARTITION [FILENAME] Flash given partition, using the image from
$ANDROID_PRODUCT_OUT if no filename is given.

basics:
devices [-l] List devices in bootloader (-l: with device paths).
getvar NAME Display given bootloader variable.
reboot [bootloader] Reboot device.

locking/unlocking:
flashing lock|unlock Lock/unlock partitions for flashing
flashing lock_critical|unlock_critical
Lock/unlock ‘critical’ bootloader partitions.
flashing get_unlock_ability
Check whether unlocking is allowed (1) or not(0).

advanced:
erase PARTITION Erase a flash partition.
format[:FS_TYPE[:SIZE]] PARTITION
Format a flash partition.
set_active SLOT Set the active slot.
oem [COMMAND…] Execute OEM-specific command.
gsi wipe|disable Wipe or disable a GSI installation (fastbootd only).
wipe-super [SUPER_EMPTY] Wipe the super partition. This will reset it to
contain an empty set of default dynamic partitions.
create-logical-partition NAME SIZE
Create a logical partition with the given name and
size, in the super partition.
delete-logical-partition NAME
Delete a logical partition with the given name.
resize-logical-partition NAME SIZE
Change the size of the named logical partition.
snapshot-update cancel On devices that support snapshot-based updates, cancel
an in-progress update. This may make the device
unbootable until it is reflashed.
snapshot-update merge On devices that support snapshot-based updates, finish
an in-progress update if it is in the “merging”
phase.
fetch PARTITION OUT_FILE Fetch a partition image from the device.
boot image:
boot KERNEL [RAMDISK [SECOND]]
Download and boot kernel from RAM.
flash:raw PARTITION KERNEL [RAMDISK [SECOND]]
Create boot image and flash it.
–dtb DTB Specify path to DTB for boot image header version 2.
–cmdline CMDLINE Override kernel command line.
–base ADDRESS Set kernel base address (default: 0x10000000).
–kernel-offset Set kernel offset (default: 0x00008000).
–ramdisk-offset Set ramdisk offset (default: 0x01000000).
–tags-offset Set tags offset (default: 0x00000100).
–dtb-offset Set dtb offset (default: 0x01100000).
–page-size BYTES Set flash page size (default: 2048).
–header-version VERSION Set boot image header version.
–os-version MAJOR[.MINOR[.PATCH]]
Set boot image OS version (default: 0.0.0).
–os-patch-level YYYY-MM-DD
Set boot image OS security patch level.

Android Things:
stage IN_FILE Sends given file to stage for the next command.
get_staged OUT_FILE Writes data staged by the last command to a file.

options:
-w Wipe userdata.
-s SERIAL Specify a USB device.
-s tcp|udp:HOST[:PORT] Specify a network device.
-S SIZE[K|M|G] Break into sparse files no larger than SIZE.
–force Force a flash operation that may be unsafe.
–slot SLOT Use SLOT; ‘all’ for both slots, ‘other’ for
non-current slot (default: current active slot).
–set-active[=SLOT] Sets the active slot before rebooting.
–skip-secondary Don’t flash secondary slots in flashall/update.
–skip-reboot Don’t reboot device after flashing.
–disable-verity Sets disable-verity when flashing vbmeta.
–disable-verification Sets disable-verification when flashing vbmeta.
–fs-options=OPTION[,OPTION]
Enable filesystem features. OPTION supports casefold, projid, compress
–unbuffered Don’t buffer input or output.
–verbose, -v Verbose output.
–version Display version.
–help, -h Show this message.

Super Fans always leave a comment :-)

36 thoughts on “ADB and Fastboot commands”

  1. Your awesome man!
    Help with rooting my droid mini xt1030 4.4.4, obakem verizon user 4.4.4 SU6-7.7
    Keys msm 8960 probp 23255.132.81.00r”/>
    The phone started with Verizon, now its at&t
    I am trying it root without a computer

    Reply
  2. Hello rootjunky! Can i unlock the bootloader for my ace 2 jellybean using those instructions you posted for galaxy nexus?

    Reply
  3. So how do I install the twrp recovery IMG on to my device and where? I have installed cm12.1 and rooted and I’d like to know what I need to do to permanently put to like to know what I need to do the permanently put TWRP recovery on, every time I do volume down and power it goes into fastboot mode and sits there. The only way I can get into twrp is with your tool app hit option 5
    Please help

    Reply
  4. Same problem with another method, it seems the ” android bootloader interface” not installed , so I ‘m trying to look for it but no answers at the moment

    Reply
  5. Hi Root Junky! I’m trying to root my Lenovo k3 note on a windows 8.1 laptop. The Lenovo drivers are recognised because after the first command the number of the phone then ‘device’ shows up. Its when I get to the adb ‘fastboot devices’ then there is no response. The number then ‘device’ should come next, but it doesn’t. I followed your video step by step and got quite far with the process. Any expert advice would be much appreciated – thanks.

    Reply
    • Hi Root Junky! I’m trying to root my Lenovo k3 note on a windows 8.1 laptop. The Lenovo drivers are recognised because after the first command the number of the phone then ‘device’ shows up. Its when I get to the adb ‘fastboot devices’ then there is no response. The number then ‘fastboot’ should come next, but it doesn’t. I followed your video step by step and got quite far with the process. Any expert advice would be much appreciated – thanks.

      Reply

Leave a Comment

Loading Facebook Comments ...