How To Use ADB and Fastboot Commands On Android

In this guide, we will look at how to use the ADB and Fastboot commands on Android needed to be able to put hands on your Android device to perform some essential functions on the device. First of all, we need to use two important tools that are Android Debug Bridge (ADB) and fastboot that is two programs that can be started via the Windows Command Prompt. Those who have installed the Android SDK on their computer with the Microsoft operating system will be able to find ADB and fastboot programs in the platform tools folder(android_sdk/platform-tools/), programs that can still be found anyway without necessarily installing the entire SDK package as you can install the minimal adb tool that contains only the files needed for ADB and fastboot and can be downloaded from the XDA website. ADB is a versatile command line tool that allows you to communicate with a device. The ADB command will enable you to smoothly perform actions on the device such as access to a Unix shell, useful to be able to execute different commands on a device.

Android debug bridge (ADB), is a versatile command line tool, which allows you to communicate with a device, easily operating certain device functions such as installing and debugging applications and accessing a Unix shell, useful for executing various commands on a device. Android debug bridge (ADB)  is a client-server program that includes the following components:

  • Client- it is used to send commands from the developer’s computer and it is possible to call it from a command line terminal by sending an adb command
  • Demon (adbd): used to execute commands on a device running as a background process on each device
  • Server: manages the communication between the client and the daemon. On the developer’s computer, the server runs as a background process

How to use ADB and fastboot commands on Android- how ADB works and fastboot

Now let’s see how ADB works when starting the ADB client, the client must check first if an ADB server process is already running, so as to start the process if it is not detected. The server, once started, will connect to the local TCP port 5037, necessary to be able to communicate with the ADB client and “listen” to all the commands sent by the latter. The connections to all the devices that are running at that moment will then be imposed by the server, identifying the emulators and scanning ports with odd numbers in the range 5555 to 5585, the interval used by the first 16 emulators. When the server finds a daemon (adbd), it proceeds to set up a connection to that port. Why are scans of only odd ports made? The reason is that each emulator uses a pair of sequential ports- a port with an even number for console connections and an odd port instead for ADB connections. Here is an example:

Emulator 1, console- 5554  
Emulator 1, adb- 5555  
Emulator 2, console- 5556  
Emulator 2, adb- 5557  
and so on …

The emulator 1, as you can see in the example, is connected to ADB on port 5555, but also to the listening console 5554. Once the server has managed to configure the connections to all the devices, it is possible to use the commands ADB to access these devices. The server, managing the connections to the devices, and managing the commands from multiple ADB clients, allows you to control any device from any client or from a script.

How to use ADB and fastboot commands on Android- how to enable USB debugging on an Android device

How to enable USB debugging on an Android device. In order to use ADB with a device that is connected via USB, USB debugging must be enabled on the operating system settings on Android, under Developer Options. Starting from Android 4.2, the Developer Options item has been hidden by default, but making it visible again is very simple as you just go to Settings> About phone> Press 7 times with your finger on Build Number until you see a small window pop-up indicating that you have become a developer and options associated with it are now active. All you have to do is go back to the Settings, and you should now display the new Developer Options item on which you will need to click on it to access it. However, consider that this step is general, in some devices, the Developer Options screen may be located or be named differently. Once inside the Developer Options screen, you can enable USB debugging to have debug mode when connected via USB and consequently now you can connect your device via USB. To verify that the device is connected, from the directory android_sdk /platform-tools, you need to run adb devices, and if there is a connection, you will see your device listed as a “device”. When connecting an Android device via USB to the computer, in versions and later of Android, the system will display a window asking whether to accept an RSA key, useful for allowing debugging through the computer in use. This is nothing more than a security system, which protects the user’s device by ensuring that USB debugging and other ADB commands cannot be performed unless the device can be unlocked and confirmed.

How to use ADB and fastboot commands on Android- how to connect an Android device via Wi-Fi instead of USB

How to connect an Android device via Wi-Fi instead of USB. Generally ADB is used to communicate with a device via USB, however, this connection cable is not the only way you can use it, in fact, it is possible to use ADB also via Wi-Fi, but after some initial settings made via USB as we will see in the following steps:

  • Connect your Android device to the adb host computer to a shared Wi-Fi network (so they must use the same wireless network). During this phase, it is important that the access point has a firewall configured to support ADB
  • If you need to connect to a Wear OS device, turn off Bluetooth on the paired phone
  • Now connect the Android device to the host computer using the USB cable
  • Set the target device for listening to a TCP / IP connection on port 5555 with the adb tcpip 5555 command
  • Disconnect the USB cable from the computer
  • You must now find the IP address of the Android device. To find it, follow the steps below (general guide for smartphones and tablets)  Settings   Device Information  Status   IP Address ; for those who have Wear OS instead- on a Wear OS device, you can find the IP address in  Settings   Wi-Fi Settings   Advanced  >  IP Address
  • Now you can connect to the device via its IP address with the adb connect  command device_ip_adress (your ip)
  • Check now that your host computer is connected to the target device using the following command:

$ adb devices

List of devices attached

device_ip_adress – 5555 device

If you detect the ADB connection ok, otherwise if this is lost you do as follows:

  • Make sure your host computer is connected to the exact same Wi-Fi network as your Android device
  • Connect again with the adb connect command
  • If the ADB connection does not work, reset the ADB host with the adb kill-server command and start again the steps to perform the wireless connection

Once the connection between computer and Android device is present, whether a USB or Wi-Fi connection is used, the ADB commands can be executed. Here are the following:

How to use ADB and fastboot commands on Android- Table 1 – Available adb commands and options

  • -s– Install the app on the SD card.
  • -d– Allows the downgrade of the version code (only for debugging packages).
  • -g– Grant all runtime permissions.
Global options Description
-a Listen on all network interfaces instead of on  localhost.
-d Directs an adb command on the only connected USB device. Returns an error when more than one USB device is connected.
-e Directs an adb command to the only running emulator. Returns an error when more than one emulator is running.
-s serial_number Directs an adb command on a specific device, to which the serial number assigned to adb refers (such as emulator-5556). Replaces the serial number value stored in the  $ANDROID_SERIALenvironment variable.
-H server The hostname of the adb server. The default is  localhost.
-P port The port number of the adb server. The default is  5037.
-L socket Listen on the provided adb server socket. The default is  tcp:localhost:5037.
General commands Description
devices [-l] Print a list of all devices. Use the option  -l to include device descriptions.
help Print a list of supported adb commands and their descriptions.
version Print the adb version number.
run-as package_name Execute commands on a device as an app (specified using  package_name  ). This allows you to execute commands in adb as if the specified app executed the command (that is, you have the same access to the device that the app has), without requiring the log in as root. This may be necessary when using adb on a non-rooted device or an emulator with a Play Store image. The app must be debuggable.
Network commands Description
connect host[:port] Connect to a device over TCP / IP. If you do not specify a port  5555, the default port is used.
disconnect [host |host:port] Log off the specified TCP / IP device running on the specified port. If you do not specify a host or port, all devices are disconnected from all TCP / IP ports. If you specify a host, but not a port  5555, the default port is used ,.
forward --list List all forwarded socket connections.
forward [--no-rebind]local remote Forward socket connections from the specified local port to the remote port specified on the device. You can specify local  and  remote ports   in the following ways:
  • tcp:port. To choose any open door, create the local value  tcp:0 .
  • localabstract:unix_domain_socket_name.
  • localreserved:unix_domain_socket_name.
  • localfilesystem:unix_domain_socket_name.
  • dev:character_device_name.
  • jdwp:pid.
forward --remove local Removes the specified forwarded socket connection.
reverse --list Lists all reverse socket connections from the device.
reverse [--no-rebind]remote local Inverts a socket connection. The  --no-rebindoption indicates that the inversion fails if the specified socket is already associated with a  reverse previous command. You can specify the port for local and remote arguments in the following ways:
  • tcp:port. To choose any open door, set the remote value  tcp:0 .
  • localabstract:unix_domain_socket_name.
  • localreserved:unix_domain_socket_name.
  • localfilesystem:unix_domain_socket_name.
reverse --remove remote Removes the inverted connection specified by the device.
reverse --remove-all Removes all reverse socket connections from the device.
File transfer commands Description
push local remote Copy files and directories from the local device (computer) to a remote location on the device.
pull [-a] remote local Copy remote files and directories to a device. Use  -aas an option to preserve the timestamp and file mode.
sync  [system|vendor|oem|data|all] Synchronize a local build from the location specified in the  $ANDROID_PRODUCT_OUTdevice. All modified files are copied from the specified partition. The default is to synchronize all partitions. This command is used only when creating the source of the Android platform. App developers don’t need to use this command  $ANDROID_PRODUCT_OUT. The environment variable is automatically set by the Android build system to contain the location of system images. Normally it is not necessary to set it  $ANDROID_PRODUCT_OUTwhen running it  adb sync, but it can be useful if you are not in a build tree (but one is available) or if you are synchronizing the build trees without going from one to the other.
$ ANDROID_PRODUCT_OUT = / out / target / product / generic 
adb sync
App installation commands Description
install [options]package Need to install the packages on the device. The possible options are as follows:
  • -l– Forward blocking the app.
  • -r– Replace the existing app.
  • -t– Allow test packages. If the APK is created using a developer preview SDK (if it is a letter instead of a number), you must include the  -toption with the install command if you install a test APK.
install-multiple[optionspackages Same options as  installwith the addition of the following:-p– Partial installation of the app.
uninstall [-k] package Remove this app package from the device. Add -kas an option to keep the data and directories of the cache.
Command backup and restore Description
backup[]  [  | ] [  | ] [  | ] [  ] [  | [  ]-f file-apk-noapk-obb-noobb-shared-noshared-all-system-nosystempackage_names Write an archive of device data to file. If you do not specify a file name, the file is the default. The package list is optional when options are specified. The following describes the uses for the other options- backup.adb-all-shared
  • -apk | -noapk– Backs up or does not back up  .apkfiles. The default is  -noapk.
  • -obb | -noobb– Backs up or does not back up  .obbfiles. The default is  -noobb.
  • -shared | -noshared– Back up or not back up shared storage. The default is  -noshared.
  • -all– Backs up all installed apps.
  • -system | -nosystem– Include or do not include system apps when backing up all installed apps (  -all). The default is  -system.
restore file Restore the contents of the device from the file.
Debug commands Description
bugreport path Print  bugreportto the specified path. If the path  is a directory, then the bug report is saved in that directory using the default file name,. Print on devices that do not support zipped bug reports. bugreport.zipstdout
jdwp Print a list of JDWP processes available on a given device. To be used to connect to a specific JDWP process. For example:forward jdwp:pid
adb forward tcp:8000 jdwp:472
jdb -attach localhost:8000
logcat [-help] [option] [filter-spec] Print the log data on the screen. For information about the  logcatcommand and the $ANDROID_LOG_TAGS environment variable, see  Filtering Log Output on the Logcat Page. The environment  $ADB_TRACEvariable contains a comma-separated list of debug information to be logged. The values can be any combination of the following:  all,  adb,  sockets,  packets,  rwx,  usb,  sync,  sysdeps,  transport, and  jdwp.
Security controls Description
disable-verity Disable  build dm-veritycontrol  userdebug. The  dm-verityis an option ensures that when a user starts a device it is in the same state it was in when it was last used.
enable-verity Reactivate  dm-veritycontrol on  userdebugbuild. The  dm-verityis an option ensures that when a user starts a device, it is in the same state it was in when it was last used.
keygen file Generate adb encrypted public and private RSA keys. The private key is stored in the file. The public key is stored. An RSA key pair is required when using adb to connect via USB for the first time. You must accept the RSA key of the host computer to grant adb access to the device explicitly. Use the environment variable to point to a file or directory containing pairs of 2048-bit RSA authentication keys generated with the command. These key pairs are added to the RSA key pairs generated by the adb$ANDROID_VENDOR_KEYSkeygenWhen the adb server needs a key, it first looks in the adb server keystore directory. If no key is found, check the  $ANDROID_VENDOR_KEYSenvironment variable for a location. If no keys are yet found, the local adb server generates and saves a new key pair in the adb server keystore directory. For this reason, only an OEM that creates a new Android device must run  'adb keygen'independently.

By default, the key pairs generated by the adb server are stored in the following directories of the key archive as  adbkey(private key) and key):

  • Linux and Mac:  $HOME/.android.
  • Windows:  %USERPOFILE%\.android.
Scripting commands Description
wait-for [-transport-state Wait for the device to be in the specified state.
  • stateThe values may be  device,  recovery,  sideloador  bootloader.
  • transport– values ​​can be  usb,  localor  any.
get-state Print the adb status of a device. The adb state can be  print offlinebootloaderor  device.
get-serialno Print the string of the serial number of the adb device.
get-devpath Print the path to the adb device.
remount Reassemble i  /system,  /vendorand  /oem partitions in read-write mode.
reboot [bootloader |recovery | sideload |sideload-auto-reboot ] Restart the device. This command starts automatically when the system image starts but also supports  bootloadere  recovery.
  • The option  bootloader restarts in bootloader mode.
  • The option recovery restarts in recovery mode.
  • The option  sideloadrestart in  sideloadrecovery and boot mode.
  • The option sideload-auto-reboot  is equal to  sideload but restarts after the sideload.
sideload otapackage sideload (install in APK format) the complete OTA package specified on the device.
root Restart adbd with root permissions.
unroot Restart adbd without root permissions.
usb Restart the adb server listening on USB.
tcpip port-number Restart the adb server listening on TCP in the specified port.
Internal debug commands Description
start-server Check if the adb server process is running.
kill-server End the adb server procedure.
reconnect Force a reconnection from the host.
reconnect device Force a reconnection from the device to force a reconnection.
Shell commands Description
shell Start a remote interactive shell on the target device.
shell -e escape_char [-n] [-T] [-t] [-x] [command] Issues a shell command to the target device and then exits the remote shell. Use any combination of the following options:
  • -e– Specify an escape character or value  noneif you do not want to use an escape character. If you do not provide a value, the default escape character (a dash (  -)) is used.
  • -n– Don’t read  stdin.
  • -T– Disable the allocation of pseudo-terminal utiity (PTY).
  • -t– Force PTY allocation.
  • -x– Disable remote exit codes and  stdout/stderrseparation.
emu command Execute an emulation console command.

You can use the command  shellto send device commands via adb, with or without entering the adb remote shell on the device. To issue a single command without entering a remote shell, use the command like  shell this:

adb [-d | -e | -s serial_number ] shell_command shell

Or enter a remote shell on such a device:

adb [-d | -and | -s serial_number ] shell

When you are ready to exit the remote shell, press Ctrl + D or type  exit.

The binaries of the shell command are stored in the device file system in  /system/bin/.

Call activity manager (am). Within an adb shell, you can issue commands with the activity manager tool (  am) to perform various system actions, such as starting a task, forcing a process to be interrupted, transmitting an intent, changing the properties of the device screen and more. In a shell, the syntax is:  am command

You can also send a task management command directly from ADB without inserting a shell

adb shell am start -a android.intent.action.VIEW

How to use ADB and fastboot commands on Android- Table 2 – Available task management commands

Command Description
start [optionsintent Start a  Activityspecified by  intent. The options are:
  • -D– Enable debugging.
  • -W– Waits for launch to complete.
  • --start-profiler file– Start the profiler and send the results to  file.
  • -P file– I like it  --start-profiler, but profiling stops when the app becomes inactive.
  • -R count– Repeat the  count start-up times of the activities. Before each repetition, the main activity will be terminated.
  • -S– Force stop the target app before starting the activity.
  • --opengl-trace– Enable tracing of OpenGL functions.
  • --user user_id | current– Specifies which user to run as; if not specified, then run as the current user.
startservice [optionsintent Start the  Servicespecified by  intent. The options are:
  • --user user_id | current– Specifies which user to run as; if not specified, then run as the current user.
force-stop package Force the interruption of everything that is associated  package(name of the package of the app).
kill [optionspackage Delete all associated processes  package (app package name). This command only kills processes that can be safely killed and that do not affect the user experience. The options are:
  • --user user_id | all | current– Specifies the user whose processes to kill; all users if not specified.
kill-all Kill all background processes.
broadcast [optionsintent Issue a transmission intent.The options are:
  • [--user user_id | all | current]– Specify which user to send; if not specified, send to all users.
instrument [optionscomponent Start monitoring with  Instrumentationan instance. The goal component is usually the form. The options are:test_package/runner_class
  • -r– Print raw results (otherwise decoded report_key_streamresult). Use with  [-e perf true]to generate raw outputs for performance measurements.
  • -e name value– Set topic  name a  value. For test runners it is a common form. -e testrunner_flag value[,value...]
  • -p file– Write profile data on  file.
  • -w– Wait for the instrumentation to finish before returning. Required for test runners.
  • --no-window-animation– Turn off window animations during execution.
  • --user user_id | current– Specifies which user equipment performs; current user if not specified.
profile start process file Start the profiler  process, write the results to  file.
profile stop process Stop the profiler  process.
dumpheap [optionsprocess file Download the bunch of  process, write to  file.The options are:
  • --user [user_id | current]– When providing a process name, specify the user of the process to be executed; use the current user if not specified.
  • -n– Download the native heap instead of the managed heap.
set-debug-app [optionspackage Set the app  packageto debug. The options are:
  • -w– Wait for the debugger to start the app.
  • --persistent– Keep this value.
clear-debug-app Delete the previous package set for debugging with  set-debug-app.
monitor [options] Monitoring starts due to crashes or ANR. The options are:
  • --gdb– Start gdbserv on the specified crash / ANR port.
screen-compat {on | off}package Check the screen compatibility mode of  package.
display-size [reset |widthxheight] Ignore the display size of the device. This command is useful for testing your app on different screen sizes by imitating a small screen resolution using a device with a large screen and vice versa. Example:
am display-size 1280x800
display-density dpi Ignore the display density of the device. This command is useful for testing the app on different screen densities on a high density screen environment using a low density screen and vice versa. Example:
am display-density 480
to-uri intent Print the specified intent specification as a URI.
to-intent-uri intent Print the specified intent specification as a  intent:URI.

Specify for intent arguments

For task manager commands that accept an  intentargument, you can specify the intent with the following options:

Call package manager (  pm)

Within an adb shell, you can issue commands with the package manager tool (  pm) to perform actions and queries on the app packages installed on the device. In a shell, the syntax is:

pm command

You can also send a package manager command directly from adb without entering a remote shell. For example:

adb shell pm uninstall com.example.MyApp

How to use ADB and fastboot commands on Android- Table 3 – Package management commands available

filter Print all packages, optionally only those whose package name contains the text.  filterOptions:
  • -f– See their associated file.
  • -d– Filter to show only disabled packages.
  • -e– Filter to show only enabled packages.
  • -s– Filter to show only system packages.
  • -3– Filter to show only third-party packages.
  • -i– See the installer for packages.
  • -u– Also includes uninstalled packages.
  • --user user_id– The user space to be queried.
list permission-groups Print all known permission groups.
list permissions [optionsgroup Print all known authorizations, optionally only those in.  groupOptions:
  • -g– Organize by group.
  • -f– Print all information.
  • -s– Short summary.
  • -d– Lists only dangerous permissions.
  • -u– List only the permissions that users will see.
list instrumentation [options] List all test packages. Options:
  • -f– Lists the APK file for the test package.
  • target_package– List the test packages for this app only.
list features Print all system features.
list libraries Print all libraries supported by the current device.
list users Print all users on the system.
path package Print the path for the data APK  package.
install [optionspath Install a package (specified by  path) in the system. Options:
  • -l– Install the package with the block forward.
  • -r– Reinstalling an existing app, keeping its data.
  • -t– Allows you to install the test APKs. Gradle generates a test APK when you have run or debugged your app or used the Android Studio Build> Build APK command   . If the APK is created using a developer preview SDK (if it  targetSdkVersionis a letter instead of a number), you must include the  -toption  with the  installcommand if you are installing a test APK.
  • -i installer_package_name– Specify the name of the installation package.
  • -s– Install the package on the shared mass memory (like the sdcard).
  • -f– Install package in internal system memory.
  • -d– Allow the version code to be downgraded.
  • -g– Grant all the permissions listed in the app manifest.
uninstall [optionspackage Removes a package from the system. Options:
  • -k– Preserve data and cache directories after package removal.
clear package Delete all data associated with a package.
enable package_or_component Enable the package or component indicated (written as “package / class”).
disable package_or_component Disable the package or component indicated (written as “package / class”).
disable-user [optionspackage_or_component Options:
  • --user user_id– The user to disable.
grant package_name permission Grant an authorization to an app. On devices with Android 6.0 (API level 23) and later versions, the authorization can be any authorization declared in the app. On devices with Android 5.1 (API level 22) and previous versions, it must be an optional authorization defined by the ‘app.
revoke package_name permission Revoke an authorization from an app. On devices with Android 6.0 (API level 23) and later versions, the authorization can be any authorization declared in the app. On devices with Android 5.1 (API level 22) and previous versions, it must be an optional authorization defined by the ‘app.
set-install-location location Change the default installation path. Position values:
  • 0– Auto- allows the system to decide the best position.
  • 1– Internal- installation on the internal device storage.
  • 2– External- on external support.

Note- it  is intended only for debugging; using this can cause app crashes and other undesirable behavior.

get-install-location Return the current installation path. Return values:
  • 0 [auto]– Allows the system to decide the best position
  • 1 [internal]– Install on the device’s internal memory
  • 2 [external]– Install on external media
set-permission-enforced permission [true |false] Specifies whether the given authorization must be applied.
trim-caches desired_free_space Cut the cache files to get the available space.
create-user user_name Create a new user with the data  user_name, printing the user’s new user ID.
remove-user user_id Remove the user with the data  user_id, deleting all the data associated with that user
get-max-users Print the maximum number of users supported by the device.

Call device policy manager (  dpm)

To help you develop and test your device management apps (or other companies), you can issue commands to the Device Policy Manager tool (  dpm). Use the tool to check the active administration app or change the status data of a policy on the device. In a shell, the syntax is:

dpm command

You can also send a device policy management command directly from adb without entering a remote shell:

adb shell dpm  command

How to use the ADB and fastboot commands on Android- Table 4 – Management commands for available device policies

Command Description
set-active-admin [optionscomponent Set the  component  as an active administrator. The options are:
  • --user user_id– Specify the destination user. You can also switch  --user currentto select the current user.
set-profile-owner [optionscomponent Set the  component  as an active administrator and its package as a profile owner for an existing user. The options are:
  • --user user_id– Specify the destination user. You can also switch  --user currentto select the current user.
  • --name name– Specify the human readable organization name.
set-device-owner [optionscomponent Set the component as an active administrator and its package as the device owner. The options are:
  • --user user_id– Specify the destination user. You can also switch  --user currentto select the current user.
  • --name name– Specify the human readable organization name.
remove-active-admin [optionscomponent Disable an active administrator. The app must declare  android:testOnly in the manifest. This command also removes device owners and profiles. The options are:
  • --user user_id– Specify the destination user. You can also switch  --user currentto select the current user.

Make a screenshot. The command  screencap is a shell utility for capturing a screenshot of a device’s display. In a shell, the syntax is:

screencap filename

To use the command screencapfrom the command  line, type the following:

adb shell screencap / sdcard / screen . pNG

Here is a sample screenshot session, which uses the adb shell to capture the screenshot and the pullcommand to download the file from the device:

$ adb shell
shell @ $ screencap / sdcard / screen . pNG
shell @ $ exit 
$ adb pull / sdcard / screen . pNG

To record a video. The command  screenrecord is a shell utility to record the display of devices with Android 4.4 (API level 19) and later versions. The utility records screen activity on an MPEG-4 file. You can use this file to create promotional or training videos or for debugging and testing.

In a shell, use the following syntax:

screenrecord [ options ] filename

To use  screenrecordfrom the command line, type the following:

adb shell screenrecord / sdcard / demo . mp4

Stop recording the screen by pressing Control + C (Command + C on Mac); otherwise, the recording stops automatically at three minutes or at the time limit set by  --time-limit. To start recording the screen of the device, execute the  screenrecordcommand to record the video. Then run the  pullcommand to download the video from the device to the host computer. Here is an example of a recording session:

$ adb shell
shell @ $ screenrecord - verbose / sdcard / demo . mp4
 ( press Control  + C to stop ) 
shell @ $ exit 
$ adb pull / sdcard / demo . mp4

The utility  screenrecord can record in any resolution and supported bit rate, while maintaining the display aspect ratio of the device. The utility records the native resolution and orientation of the screen by default, with a maximum length of three minutes.

Limitations of  screenrecord:

  • Audio is not recorded with the video file.
  • Video recording is not available for devices with the Wear operating system.
  • Some devices may not be able to record with native display resolution. If you experience problems with screen recording, try using a lower screen resolution.
  • Screen rotation during recording is not supported. If the screen rotates during recording, part of the screen is cut off during recording.

How to use ADB and fastboot commands on Android- Table 5 – Screenrecord options

Options Description
--help View the command syntax and options
--size widthxheight Set the video size:  1280x720. The default is the device’s native display resolution (if supported), 1280 × 720 otherwise. For best results, use a size supported by your device’s Advanced Video Coding (AVC) encoder.
--bit-rate rate Set the video bit rate for video, in megabits per second. The default is 4Mbps. You can increase the bit rate to improve the quality of the video, but this way you get larger movie files. The following example sets the recording bit rate to 6Mbps:screenrecord –bit-rate 6000000 /sdcard/demo.mp4
--time-limit time Set the maximum recording time, in seconds. The default and maximum value is 180 (3 minutes).
--rotate Rotate the output 90 degrees. This functionality is experimental.
--verbose Displays the log information on the command line screen. If this option is not set, the utility does not display any information during execution.

ART profiles for apps. Starting from Android 7.0 (API 24 level), Android Runtime (ART) collects the execution profiles for the installed apps, used to optimize the performance of the app. You can examine the collected profiles to understand which methods are determined to be run frequently and which classes are used during app startup.

To produce a text form of the profile information, use the command:

adb shell cmd package dump-profiles package
To recover the product file, use:
adb pull / data / misc / profman / package .txt

Other shell commands

For a list of all available shell programs, use the following command:

adb shell ls / system / bin

The guide is available for most commands.

The following table lists some of the more common adb shell commands.

How to use ADB and fastboot commands on Android- Table 6 – Other adb shell commands

Shell command Description
dumpsys Download system data to the screen.
dumpstate Dump the status to a file.
logcat [option]...  [filter-spec]... Enable system and app registration and print output on the screen.
dmesg Print kernel debug messages on the screen.
start Start (restart) a device.
stop Stop running a device.
sqlite3 Start the  sqlite3command line program. The  sqlite3tool includes commands like  .dumpprint the contents of a table and .schemaprints the SQL CREATE statement for an existing table. You can also execute SQLite commands on the fly.SQLite3 databases are stored in the folder./data/data/package_name/databases/

For example:

$ adb -s emulator-5554 shell 
$ sqlite3 /data/data/ 
SQLite version 3.3.12 
Enter ".help" for instructions

We have therefore seen  how to use the ADB and Fastboot commands on Android , all the commands have been recovered from the official source and for some comprehension problems caused by the translation of the text found in the guide or to read all the descriptions of the commands in original language, I refer you to the reading of the  SOURCE.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.