How to turn off screen of android with terminal emulator? How to turn off screen of android with terminal emulator?  I am using Android 5.0.
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:

su
input keyevent 26


In any good terminal emulator.

If you have not rooted

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


Install ADB (Instructions vary between windows, Mac and Linux)
Enable "USB Debugging in settings > developer options (if you cannot find developer options, tap the build number in 'about phone' seven times.)
Connect your device to the PC, and connect via ADB
Run: adb shell input keyevent 26