How to turn off screen of android with terminal emulator? I am using Android 5.0.

  • In ADB, try 'adb shell input keyevent 26' (no ' marks)
    – Dan Brown
    Aug 5 '16 at 18:00
  • 1
    @DanB From an in-Android Terminal emulator, it's just input keyevent 26. It's worth noting that the phone didn't accept this event, unless sent as root.
    – Grimoire
    Aug 5 '16 at 20:13
  • @DeathMaskSalesman Ah OK. I was not sure at what point to shorten it to.
    – Dan Brown
    Aug 5 '16 at 20:24
  • @DanB Your version is perfect for use from adb, and it may also avoid the user to be root.
    – Grimoire
    Aug 5 '16 at 20:27
  • @DeathMaskSalesman Yes, which is why I suggested it in the first place. I left it as a comment because its too blunt/short for an answer.
    – Dan Brown
    Aug 5 '16 at 20:36

There are two ways of doing this, depending on if you have root or not on your device.

If you use root

If you have rooted, run:

input keyevent 26

In any good terminal emulator.

If you have not rooted

If you haven't rooted, either root, or:

  1. Install ADB (Instructions vary between windows, Mac and Linux)
  2. Enable "USB Debugging in settings > developer options (if you cannot find developer options, tap the build number in 'about phone' seven times.)
  3. Connect your device to the PC, and connect via ADB
  4. Run: adb shell input keyevent 26
  • Thaaaaaaaaaaaaaaaaaank's its work 5/5 :)
    – MBZ XI
    Aug 9 '16 at 17:36
  • @MBZXI If it works, please mark it as an answer (that tick under the downvote button)
    – Dan Brown
    Aug 9 '16 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.