22
votes

There are questions pertaining to the use of the Android Shell or to finding a documentation of the Shell commands on Android. Since I haven't found anything convenient, I would like to use this thread to compile a list of "useful" Android commands. I am going to add commands as they are posted.

|
  • 4
    What defines "useful"? How will answers be bounded or evaluated? – eldarerathis Jun 30 '11 at 13:10
  • That could be useful for everyday use while working with the terminal. I will turn this into a Wiki as soon as the 8 hours time limit has past...ppl will figure it out than :) – n3rd Jun 30 '11 at 13:40
21
votes

App Management

Use Android package manager pm

usage: pm [list|path|install|uninstall]
       pm list packages [-f]
       pm list permission-groups
       pm list permissions [-g] [-f] [-d] [-u] [GROUP]
       pm list instrumentation [-f] [TARGET-PACKAGE]
       pm list features
       pm path PACKAGE
       pm install [-l] [-r] [-t] [-i INSTALLER_PACKAGE_NAME] [-s] [-f] PATH
       pm uninstall [-k] PACKAGE
       pm enable PACKAGE_OR_COMPONENT
       pm disable PACKAGE_OR_COMPONENT
       pm setInstallLocation [0/auto] [1/internal] [2/external]

Examples

Install the package com.twitter.android-1.apk from the SD card

pm install /sdcard/com.twitter.android-1.apk

List installed packages that contain the term twitter

pm list packages | grep twitter

Show the install directory of the twitter package

pm path com.twitter.android

Processes

top

Lists all running processes / apps with live updates showing CPU usage, PID,...

ps

Lists all running processes / apps and allows filtering using grep

Examples

ps | grep apps

Lists all running apps on your phone

Mounting

mount -o rw,remount -t "filesystem" "Device" "Mount Point"

Allows you to remount your partitions for write access or to mount images.

Examples

Write access for the root filesystem

mount -o rw,remount -t rootfs /

Write access for your /system partition

mount -o rw,remount -t yaffs2 /dev/block/mtdblock4 /system

Write access for /system using busybox

busybox mount -o remount,rw /system

Mount the contents of myimage.img, viewable in the folder myimage

mount -o loop /sdcard/myimage.img myimage

Other

getprop can show interesting details from the device configuration, such as DNS servers, gateways, GSM details, running services, build parameters, version info etc.

|
  • netcfg is ifconfig for android.. – mpapec Jul 14 '15 at 8:23
-1
votes

here is /system/bin I haven't gone through yet to add documentation though, my apologies. I have made a google doc where I and some friends plan to put our documentation over spring break. If people want to help out, it would be much appreciated.
Android Shell Commands


/system/bin contents:

BasicHashtable_test

BlobCache_test

InputChannel_test

InputDispatcher_test

InputEvent_test

InputPublisherAndConsumer_test

InputReader_test

Looper_test

ObbFile_test

String8_test

Unicode_test

Vector_test

ZipFileRO_test

adb

am

app_process

applypatch

applypatch_static

asan

asanwrapper

atrace

audioloop

bmgr

bootanimation

bu

bugreport

cat

check_prereq

chmod

chown

cmp

codec

content

corrupt_gdt_free_blocks

dalvikvm

date

dd

debuggerd

decoder

dexopt

df

dhcpcd

dmesg

drmserver

dumpstate

dumpsys

flash_image

fsck_msdos

gdbjithelper

gdbserver

getevent

getprop

gzip

hd

id

ifconfig

iftop

ime

input

insmod

installd

ioctl

ionice

ip6tables

iptables

keystore

keystore_cli

kill

linker

ln

log

logcat

logwrapper

ls

lsmod

lsof

make_ext4fs

md5

mdnsd

mediaserver

mkdir

mksh

monkey

mount

mtpd

mv

nandread

ndc

netcfg

netd

netstat

newfs_msdos

notify

ping

ping6

pm

pppd

printenv

ps

qemu-props

qemud

r

racoon

radiooptions

reboot

record

recordvideo

recovery

renice

requestsync

rild

rm

rmdir

rmmod

route

run-as

schedtest

schedtop

screencap

screenshot

sdcard

sendevent

sensorservice

service

servicemanager

set_ext4_err_bit

setconsole

setprop

sf2

sh

showlease

skia_test

sleep

smd

stagefright

start

stop

stream

surfaceflinger

svc

sync

system_server

testid3

toolbox

top

touch

uiautomator

uim-sysfs

umount

updater

uptime vdc vmstat vold watchprops wipe

|

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