125

How do I halt an android phone using adb command? I can reboot, but I don't know how to halt.

I tried shutdown -k wait command, but it did not work.

Blacklist Human
  • 1,451
  • 4
  • 12
  • 6

6 Answers6

177

Try adb shell reboot -p to shutdown the phone.

geffchang
  • 17,565
  • 18
  • 57
  • 73
  • 50
    For those who wonder what the "p" stands for: it's short for --poweroff :) – Izzy Jun 26 '13 at 07:15
  • 7
    it would have been better unix way: "shutdown" for shutdown and "shutdown -r" for reboot – Mert Akcakaya Oct 03 '13 at 14:22
  • Doesn't work for me though. Nexus 4 on Lollipop 5.0.1 (rooted), or LG P705 on ICS 4.0.3 (unrooted). I wonder if it's related to ADB version or not (mine's 1.0.32). – Andrew T. Jan 30 '15 at 05:48
  • 7
    Try adb reboot -p (leave out shell). – Caleb Xu Mar 09 '15 at 01:07
  • 4
    reboot -p only reboots my tablet. Doesn't shutdown. – JohnyTex Dec 27 '16 at 13:03
  • 1
    How did you find out? It's not mentioned in the official doc: https://developer.android.com/studio/command-line/adb – minipif Jan 22 '19 at 01:22
  • so strange on my lg g5 i have to do adb shell reboot -p. if i do adb reboot -p it just reboots and ignores the flag. – j2emanue Mar 26 '19 at 09:40
  • works fine on a nokia 6.1 running android 9 without root. at first glance I thought that it just rebooted because of the splash screen immediatly showing, but it was the "charging" mode that automatically booted up since the phone is plugged for adb. – XioRcaL Apr 15 '19 at 08:01
  • Google Glass XE23 doesnt power off with the button as some docs indicate so I needed this to power off for storage. Thanks! – rainabba May 22 '20 at 20:02
  • 1
    Seems to power off immediately, no graceful shutdown(?). – Golar Ramblar Jul 31 '21 at 19:13
  • Does not work for my phone with AOSP rom on Android 10 unfortunately, seems to be model, adb version or Android Version related? – phrogg Sep 20 '21 at 14:28
27

Note: All the following commands below require root access.

On Android Oreo, this works and does a graceful shutdown:

adb shell su -c 'am start -a com.android.internal.intent.action.REQUEST_SHUTDOWN'
adb shell su -c 'am start -n android/com.android.internal.app.ShutdownActivity'  #alternative; the aforesaid intent is supposed to be passed to this component under normal circumstances, but calling the component alone works too
adb shell su -c 'svc power shutdown'       # alternative; tested on Android 5.0, 6.0.1 and 8.1.0

Following is an alternative and is tested on Android 4.2, 5.0 and 6.0.1. I do not know about Nougat but it doesn't work for Oreo though.

adb shell su -c 'am start -a android.intent.action.ACTION_REQUEST_SHUTDOWN --ez KEY_CONFIRM true --activity-clear-task'   # I kept this here for historical purposes only.

For low-level and instant shutdown

If you're running Android KitKat or above* and have root access, you can try this command:

adb shell su -c 'setprop sys.powerctl reboot,recovery'
  • replace su -c with adb shell to run the command using
  • replace reboot,recovery with reboot to reboot the device
  • replace reboot,recovery with shutdown to shutdown the device

* The last version on which the command is tested upon is stock Android 6.0.1.

Firelord
  • 25,084
  • 20
  • 124
  • 286
6

here is an another method, go to android shell then shutdown the phone!

adb shell
shutdown

enter image description here

Mahdi Rashidi
  • 169
  • 1
  • 2
4

In Windows Sub-system for Android(WSA) shutdown doesn't work instead try doing

adb shell reboot -p or

adb shell
reboot -p

Shutdown Windows Sub-system for Android(WSA) via adb

pro_nav
  • 71
  • 3
0

To shutdown the phone use this command on PC:

adb shell halt
Firelord
  • 25,084
  • 20
  • 124
  • 286
  • 2
    Doesn't work on stock 5.0 Galaxy S5 & 5.1 nexus 7, Interestingly when run in CM12 Reboot process asked for superuser access and works in CM12 – Manu Sep 26 '15 at 16:28
-1

Try

adb shell "input keyevent 26"

It's work for me.