Last active
October 20, 2022 08:21
-
-
Save anandharaj-dotworld/2eb937c6a771fe71bb30e21ae117159f to your computer and use it in GitHub Desktop.
Basic adb commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# connect adb over tcp | |
adb connect <ip>:<port> | |
# App install over adb | |
adb install package_name | |
# app install adb shell | |
adb shell pm install <app_path> | |
# app uninstall over adb | |
adb uninstall <package_name> (or) | |
adb shell pm uninstall <package_name> | |
# list installed packages | |
adb shell pm list packages | |
# dump package activity | |
adb shell dumpsys activity <package_name> | |
# Check cpu | |
adb shell top | |
# Check useranme | |
adb shell whoami | |
# Find pidof running app | |
Use "top" command or pidof <package_name> | |
# Kill running app | |
kill -9 pid | |
# start app | |
am start -n <activity_name> | |
# Mount directory over adb | |
adb remount | |
# Start adb over root | |
adb root | |
# Pull directory | |
adb pull /data/data/<package_name>/ | |
# push directory | |
adb push <source_dir_name> <destination_dir_name> | |
# push file | |
adb pull /data/data/<package_name>/<file_name> | |
# push file | |
adb push <filename> <destination_file_name> | |
# copy file over adb shell | |
adb shell cp <source_location> <destination_location> | |
# mv or rename | |
adb shell mv <sourcefile> <destinatio_new_file_name> | |
# Access su | |
adb shell su | |
# Disable selinux | |
setenforce 0 (Don't do it as 1. Some devices are crash the operating system.) | |
# Get battery | |
dumpsys battery (You can use more system info using dumpsys) | |
# Read file | |
adb shell cat <file_name> | |
# write_ file | |
You need vm or nano to easy write file. | |
echo "text" > <filename> | |
# check path | |
echo $PATH | |
# add path to variable | |
export PATH=$PATH:<new_path> | |
# delete file | |
rm filename | |
# delete directory | |
rm -r <directory> | |
# delete multiple | |
rm -r <file_*.txt> <directory_name> <file_name> | |
# For list file | |
ls | |
# For list with permissions | |
ls -l | |
# For list with hidden | |
ls -a | |
# Given permission to file | |
chmod <permission> <file_name> | |
Permission type : +x 0777 0644 ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment