Following my recent write up on Secure Settings not playing well with Android 6.0 devices, I decided to make another post about Tasker Run Shell actions. I think it is a good idea to keep all of them handy in one place instead of running around the web, looking for the information.  I have a small collection of these already in my notepad. I will be updating the list each time I come across something interesting. Watch this space then, perhaps subscribe to receive updates to this post. Perhaps, later on, I will create one for the intents as well. You can read more on intents here.

Tasker Run Shell actions

Not all devices have been made equal and to find out what settings can be toggled on yours, you need to check what is available. There are 3 groups of settings: secure, global and system. To check the status of the settings simply run one of:

settings list system
settings list global
settings list secure

Store result in a variable %Settings. You can also use Set Clipboard to %Settings, and use Join to bring it on your PC, or use Write file with %Settings to save it to a text file.  In the file, you will find the list of available settings to be toggled. These will have their current state already specified by the number at the end (0= disabled, 1=enabled).

There are 2 more commands I want you to learn.

settings get secure/global/system name_of_the_setting
settings put secure/global/system name_of_the_setting 0 or 1
  • GET allows you to get the current status of the setting
  • PUT allows you to set the setting to your desired value

This alone will let you compose about 100 Run Shell commands on your own! Something I have noticed, to see the setting being changed on your mobile, you will have to leave the equivalent menu and reenter it again, so changes made would reflect in the user interface. Simply putting the screen to the background and going back won’t work. I kept  few most popular toggles in the list as an example, and for an easy access.

All Android Settings [spoiler]

You can use semicolon to add more than one command to the Tasker run shell.

Run Shell actions in Tasker (root may be required):

Airplane Mode on/off

settings put global airplane_mode_on 1; am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true
settings put global airplane_mode_on 0; am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false

Mobile Data on/off

svc data enable
svc data disable

Check if folder is present (1=no 0=yes)

-d /sdcard/DCIM/Camera/ echo 1 || echo 0
Store output %Variable

Extract ZIP file (%File)

unzip %file /sdcard/

Move file, copy file

mv /original/path /new/path
cp /original/path /new/path

Delete file, delete folder

rm /path/to/file
rm -r /path/to/folder

Read file, write variable (%var) to file

cat /path/to/file
echo %var > /path/to/file
Store output %Variable

Make /system rewritable, make system read-only

mount -o remount,rw /system
mount -o remount,ro /system

Change file permission (/system/etc/hosts as example) file permission types (7=rwx; 6=rw; 4=r) (chmod(root:group;user))

chmod 644 /system/etc/hosts

Check the md5sum of the file

md5sum /path/to/file

Check if process is running (returns process or empty)

pgrep -x
Store output %Variable

Stop current download

am force-stop
pm clear

Kill an app (Chrome in my example)

am force-stop

Restart system UI

pkill -l TERM -f

Reboot, reboot to recovery

svc power reboot
svc power reboot recovery

Screenshot to sdcard

screencap -p /sdcard/screengrab.jpg

Open a URL or website

am start -a android.intent.action.VIEW -d

Check if keyboard is out (1=no 0=yes)

cat /proc/$(pgrep com.touchtype.swiftkey)/oom_adj


dumpsys input_method | grep InputShown
Store output %Variable

Ping IP (-c count,-i interval, -s packetsize, -t ttl xxx = IP)

ping -c 3
Store output %Variable

Store last input coordinates

getevent -lc 3 /dev/input/event1 | grep ABS_MT_POSITION_.
Store output %Variable

Emulate user tap input
input tap X Y

Emulate user long tap input (duration 250)

input swipe X1 Y1 X1 Y1 250

Emulate text input

input text sampletext

Emulate user swipe (z = duration)

input swipe X1 Y1 X2 Y2 Z

Emulate specific key (back in this example)

input keyevent 4
List of all Key Events [spoiler]

Get the battery saver profile STATUS/ENABLE/DISABLE

settings get global low_power
settings put global low_power 1
settings put global low_power 0


am stopservice com.oasisfeng.greenify/.DozeService
pm disable com.oasisfeng.greenify/.DozeService
pm enable com.oasisfeng.greenify/.DozeService
am startservice com.oasisfeng.greenify/.DozeService

Display your battery level, health and temperature (output needs formatting)

dumpsys battery | grep health
dumpsys battery | grep temperature
Store output %Variable

Wi-Fi (scanning always available) on/off

settings put global wifi_scan_always_enabled 1
settings put global wifi_scan_always_enabled 0

Resize the screen and reset

wm overscan 150,750,0,0
wm overscan reset

Query Wi-Fi (scanning always available) status

settings get global wifi_scan_always_enabled
Store output %Variable 

Query currently enabled Location providers

settings get secure location_providers_allowed
Store output %Variable

Query enabled Accessibility Services

settings get secure enabled_accessibility_services
Store output %Variable

Query enabled Notification Listeners

settings get secure enabled_notification_listeners
Store output %Variable

Enable an Accessibility Service (AutoInput in my example)

settings get secure enabled_accessibility_services
Store output %Variable 
settings put secure enabled_accessibility_services %Variable:com.joaomgcd.autoinput/com.joaomgcd.autoinput.service.ServiceAccessibility

Enable a Notification Listener (AutoNotification in my example)

settings get secure enabled_notification_listeners
Store output %Variable
settings put secure enabled_notification_listeners %Variable:com.joaomgcd.autonotification/com.joaomgcd.autonotification.service.ServiceNotificationIntercept
Support NotEnoughTech
A lot of time and effort goes into keeping NotEnoughTech alive! If my work helped you out, consider buying me a coffee or check out exclusive rewards available to Patreon supporters.
SOURCEThank you to the reddit contributors