ADB & adb shell-related commands

Source: Internet
Author: User

Configure the ADB command on your Mac

When you use the ADB command in Mac OS, you should configure the variables as follows:

First, the terminal input CD ~

Second, enter touch. Bash_profile return

Touch: If not, create a file, if any, update the file time

Third, input open-e. bash_profile

Open: Opening file

The file will open in TextEdit after the carriage return (if the environment variable is not configured, it should be a blank file). Add the following content to the file

Export Path=${path}:/users/admin/applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools

This is the path on my machine, specific personal machine path, can right click platform-tools--"Display Introduction view

Using ADB

ADB Shell gets all the phone processes:
Displays all the processes that are executing on the Android emulator:

db shell ps -x

adb shell gets mobile device information:
1, Equipment basic information: Cat/system/build.prop | grep "Product"
2. CPU information:/proc/cpuinfo and/proc/stat
3. Memory:/proc/meminfo adb shell Dumpsys meminfo
Terms
Vss-virtual Set Size Virtual memory consumption (contains memory consumed by shared libraries)
Rss-resident Set Size actually uses physical memory (contains memory consumed by shared libraries)
Pss-proportional Set Size Actual physical memory used (proportional allocation of memory consumed by shared libraries)
Uss-unique the Set Size process consumes the physical memory alone (does not contain the memory occupied by the shared library)
4.

adb shell dumpsys batteryinfo >f:\battery.log

Transferring files to an Android SD card via ADB
1. Create an SD card and mount it to the emulator
Run cmd, and CD to the Android-sdk\tools\ directory. Enter the following command to create and mount the SD card to the emulator. Mksdcard parameters in the size of the SD card can be either K or m (must be uppercase), he will create a file in the tools directory called Sdcard.img. Mount the SD card and launch the emulator by adding-sdcard after emulator.

mksdcard 256M sdcard.imgemulator -avd 2.2 -sdcard sdcard.img
    1. To manipulate a single file through ADB push, you can add files to the SD card. If you want to change the file name when you push, just change the second parameter of the push to the full path (directory + filename), such as/sdcard/test-0.jpg. To restart the emulator, you can see what's new in the SD card.
adb push E:/images/test.jpg /sdcard/adb push E:/images/test.jpg /sdcard/test-0.jpg

To extract the test.jpg, you can use the ADB pull command. The second parameter is the local hard disk address, if you do not want to change the name, only need to enter the directory address (not add), and need to change the name, the full path of the input file is OK.

adb pull /sdcard/images/test.jpg E:\tmpadb pull /sdcard/images/test.jpg E:\tmp\test-0.jpg
    1. To manipulate the entire folder to add all the contents of a folder on the hard disk to the SD card, you can use the following command (note that the pic cannot be followed by \):
adb push E:\Android\pic /sdcard/images/

This command adds the contents of the pic file and its subfolders to the images directory of the SD card. If there is no images directory under the SD card, it can be created by ADB shell, as follows:

adb shellcd /sdcardmkdir imagesexit

To export the entire folder, you can use the following command:

adb pull /sdcard/images/ E:\tmp

More:
ADB devices//list all connected devices
ADB connect Device command:
ADB push <local> <remote>//Copy File/directory to device
ADB pull <remote> [<local>]//Copy files/directories from device
adb sync [<directory>]//Copy from host to device only if change occurs
ADB shell//Run Remote shell interaction
ADB shell <command>//Run Remote shell command
ADB EMU <command>//Run Simulation console command
ADB logcat [<filter-spec>]//Browse device logs
ADB forward <local> <remote>//Forwarding socket connections
ADB install [-l] [-r] [-S] <file>//Copy file package to device and install
adb uninstall [-K] <package>//Uninstall package,-K means preserve data and cache
ADB bugreport//Return all bugreport information
ADB Help
ADB version
Script:
ADB wait-for-device//block until device is online
ADB start-server
ADB kill-server
ADB get-state//print offline|bootloader|device information
ADB Get-serialno
ADB Status-window//continuous printing device status
ADB remount//heavy load/system partition
ADB reboot [Bootloader|recomry]
ADB Reboot-bootloader
ADB root
ADB usb

Article reprint: https://testerhome.com/topics/265

ADB & adb shell-related commands

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.