GuidePublished: 6 min read

Run ADB Shell Commands on Android Without a PC or Root

Run adb shell commands on the phone itself, without a PC or root. App shell vs adb shell rights, and useful pm, am, settings, dumpsys, wm and cmd commands to try.

To run real adb shell commands on an Android phone without a PC or root, connect a terminal app on the phone to the phone's own adb through Wireless debugging (Android 11+). Commands then run as the shell user, the same user a computer gets with adb shell, which can do much more than a normal terminal app: disable apps, change hidden settings, grant permissions, read dumpsys. Without that connection, a terminal app only has its own app permissions. This guide explains the difference and lists commands worth knowing.

App shell vs adb shell: the rights are different

Android gives every app its own Linux user. A terminal app like Termux, or ADB Kit when it is not connected, runs commands as that app. Commands that change the system are refused.

When the terminal is connected through adb, the commands run as the shell user (uid 2000), which Android allows to manage apps and settings. It is not root: system files stay read-only and other apps' private data stays locked.

TaskApp shelladb shell userRoot
ls, cat, ping, topYes (own files and public folders)YesYes
List packages (pm list packages)PartlyYesYes
Disable or uninstall system apps for the userNoYesYes
Grant or revoke runtime permissionsNoYes (many)Yes
settings put global/secure/systemNoYesYes
dumpsys, logcat for all appsNoYesYes
input tap, screencap, screenrecordNoYesYes
Change /system, read /data/data/<app>NoNoYes

Open a shell on the phone with ADB Kit

ADB Kit has a Termux-style terminal in its Shell tab, with a built-in adb client, so it needs no other app.

  1. Do the one-time setup on Home: Wi-Fi, Developer options, Wireless debugging, then Start pairing and type the six-digit code into the notification. Details in use ADB on Android without a PC.
  2. Open Shell. The top bar tells you which shell you have:
  3. adb shell · full access: connected, commands run as the shell user.
  4. App shell · limited: not connected, commands run with the app's own permissions. Tap Use adb to switch.
  5. Type commands in the command line and press Enter.

What the terminal gives you:

  • One shell that stays open, so cd, environment variables and history (Up arrow) work.
  • Tab completion, Ctrl+C to stop a command, colours, and full-screen programs such as top, vi and less.
  • Two rows of extra keys (ESC, Tab, CTRL, ALT, arrows, HOME, END, PGUP, PGDN), and folder and file suggestions above them: type cd and tap a folder.
  • Snippets: saved commands you run with one tap.
  • Pinch with two fingers to change the text size (also Text size in Settings).
  • Import file and Export file in the ⋮ menu, to move files between the shell's folder and the phone's file picker.

When the app shell says "Permission denied" in shared storage, a bar appears: Only adb can open these files. Its Connect button restarts the shell on adb in the same folder.

Commands worth knowing

All of these work in the adb shell without root. Replace package names with your own. Find them with pm list packages.

pm: packages

pm list packages -3                 # user-installed apps
pm list packages | grep -i facebook # find a package
pm path com.example.app             # where the APK lives
pm disable-user --user 0 com.example.app   # turn an app off
pm enable com.example.app                  # turn it back on
pm uninstall -k --user 0 com.example.app   # remove for this user, keep data
pm grant com.example.app android.permission.POST_NOTIFICATIONS
pm revoke com.example.app android.permission.ACCESS_FINE_LOCATION

pm uninstall --user 0 removes a preinstalled app only for your user, and a factory reset brings it back. Removing the wrong system app can break the phone, so prefer disable-user, which is easy to undo.

am: activities and apps

am start -a android.intent.action.VIEW -d https://example.com
am start -n com.android.settings/.Settings
am force-stop com.example.app

settings: hidden and normal settings

settings list global
settings get global animator_duration_scale
settings put global window_animation_scale 0.5
settings put global transition_animation_scale 0.5
settings put global animator_duration_scale 0.5
settings put system screen_off_timeout 600000    # 10 minutes

Write down the old value with settings get before you change one.

dumpsys: system state

dumpsys battery
dumpsys battery set level 15    # fake level for testing
dumpsys battery reset
dumpsys wifi | grep -i rssi
dumpsys package com.example.app | grep version

wm: screen size and density

wm size
wm density
wm density 400     # smaller UI
wm density reset

cmd: newer service commands

cmd package list packages
cmd appops set com.example.app RUN_IN_BACKGROUND ignore
cmd wifi status

Input, screen and logs

input keyevent KEYCODE_HOME
input text "hello"
screencap -p /sdcard/Download/shot.png
logcat -d | tail -n 50
getprop ro.product.model

input and permission changes on Xiaomi, Redmi and POCO also need USB debugging (Security settings), see Xiaomi security settings. More commands are in the ADB commands cheat sheet.

Save repeated commands as recipes

If you run the same commands often, put them in Auto script. A recipe is a list of shell commands run step by step, with one tap or daily at a set time. Recipes can be exported and imported as JSON files. Imported ones always arrive with the schedule off, so you can check the commands first. A scheduled run needs Wireless debugging on at that time.

Other ways

  • Termux with android-tools: install adb in Termux, then adb pair 127.0.0.1:<port> and adb connect 127.0.0.1:<port>, typing the ports from the Wireless debugging screen each time. You then run adb shell inside Termux.
  • A computer: adb shell over USB or Wi-Fi gives the same rights, see what ADB is.

Common problems

  • Permission denied or SecurityException: you are in the app shell, or the command needs root. Check the top bar for adb shell · full access.
  • "Process completed": the shell exited. Press Enter for a new session.
  • The shell disconnected: Wireless debugging turned off. Switch it on again and ADB Kit reconnects. See Wireless debugging keeps turning off.
  • cmd: Can't find service: that service does not exist on your Android version or brand.

Safety note

The adb shell user can remove apps and change settings that keep the phone working. Do not paste commands you do not understand, especially pm uninstall, pm clear or settings put secure. When in doubt, use disable-user or note the old value first.