Skip to main content

Execute Mobile Shell Command

Command description​

Execute a shell command on the mobile device, for example to query system information, read files, or troubleshoot the device.

Command Input Parameters​

input parametersInput parameter typeDescription
Mobile Device ObjectPhoneConnected mobile object
Shell CommandstrShell command to run on the mobile device

Command Output Parameters​

Output parametersOutput parameter typeDescription
Return ValueintShell command exit code; 0 usually indicates success
OutputstrStandard output produced by the shell command

Type definition reference​

Return value description​

return valueDescription
0Command execution successful
Not 0The command failed or returned a nonzero status; inspect Output for details

Common command examples​

ls /sdcard/Download
pm list packages
getprop ro.product.model
tip

Enable Developer options on the mobile device, then connect it to the computer with a USB cable. See Connect Mobile Device

Example​

Run the ls command

FAQ​

See Mobile Automation FAQ