"adb shell" - Remote Shell Interface

This section describes the 'adb shell' command, which gives you a shell interface to the connected Android operating system. The shell interface allows you to manage the Android file system and invoke Android command line programs.

Another important command is the "adb shell" command, which gives you a shell interface to the connected Android operating system. The shell interface allows you to manage the Android file system and invoke Android command line programs.

Here is a "adb shell" command session I did on my Android 5.1.1 emulator:

C:\local\android-sdk-windows\platform-tools>adb shell

root@generic:/ # pwd
pwd
/
root@generic:/ # ls -l
ls -l
drwxr-xr-x root   root            2015-06-21 acct
drwxrwx--- system cache           2015-06-21 cache
lrwxrwxrwx root   root            1969-12-31 charger -> /sbin/healthd
dr-x------ root   root            2015-06-21 config
lrwxrwxrwx root   root            2015-06-21 d -> /sys/kernel/debug
drwxrwx--x system system          2015-06-21 data
-rw-r--r-- root   root        281 1969-12-31 default.prop
drwxr-xr-x root   root            2015-06-21 dev
lrwxrwxrwx root   root            2015-06-21 etc -> /system/etc
-rw-r--r-- root   root      11166 1969-12-31 file_contexts
-rw-r----- root   root        922 1969-12-31 fstab.goldfish
-rwxr-x--- root   root     301452 1969-12-31 init
-rwxr-x--- root   root        944 1969-12-31 init.environ.rc
-rwxr-x--- root   root       2836 1969-12-31 init.goldfish.rc
-rwxr-x--- root   root      21728 1969-12-31 init.rc
-rwxr-x--- root   root       1927 1969-12-31 init.trace.rc
-rwxr-x--- root   root       3885 1969-12-31 init.usb.rc
-rwxr-x--- root   root        301 1969-12-31 init.zygote32.rc
drwxrwxr-x root   system          2015-06-21 mnt
dr-xr-xr-x root   root            1969-12-31 proc
-rw-r--r-- root   root       2771 1969-12-31 property_contexts
drwx------ root   root            2014-09-16 root
drwxr-x--- root   root            1969-12-31 sbin
lrwxrwxrwx root   root            2015-06-21 sdcard -> /storage/sdcard
-rw-r--r-- root   root        471 1969-12-31 seapp_contexts
-rw-r--r-- root   root         63 1969-12-31 selinux_version
-rw-r--r-- root   root     118317 1969-12-31 sepolicy
-rw-r--r-- root   root       9438 1969-12-31 service_contexts
drwxr-x--x root   sdcard_r        2015-06-21 storage
dr-xr-xr-x root   root            2015-06-21 sys
drwxr-xr-x root   root            1969-12-31 system
-rw-r--r-- root   root        323 1969-12-31 ueventd.goldfish.rc
-rw-r--r-- root   root       4464 1969-12-31 ueventd.rc
lrwxrwxrwx root   root            2015-06-21 vendor -> /system/vendor

root@generic:/ # cat default.prop
cat default.prop
#
# ADDITIONAL_DEFAULT_PROPERTIES
#
ro.secure=0
ro.allow.mock.location=1
ro.debuggable=1
ro.zygote=zygote32
dalvik.vm.dex2oat-Xms=64m
dalvik.vm.dex2oat-Xmx=512m
dalvik.vm.image-dex2oat-Xms=64m
dalvik.vm.image-dex2oat-Xmx=64m
ro.dalvik.vm.native.bridge=0
persist.sys.usb.config=adb

root@generic:/ # df
df
Filesystem               Size     Used     Free   Blksize
/dev                   242.9M    24.0K   242.8M   4096
/sys/fs/cgroup         242.9M    12.0K   242.9M   4096
/mnt/asec              242.9M     0.0K   242.9M   4096
/mnt/obb               242.9M     0.0K   242.9M   4096
/system                541.3M   363.9M   177.5M   4096
/data                  541.3M   147.2M   394.1M   4096
/cache                  65.0M     4.3M    60.6M   4096
/mnt/media_rw/sdcard    31.5M     8.0K    31.5M   512
/storage/sdcard         31.5M     8.0K    31.5M   512

root@generic:/ # ps
ps
USER    PID PPID VSIZE  RSS   NAME
root     1    0  8784   608   /init
root     2    0  0      0     kthreadd
root     3    2  0      0     ksoftirqd/0
root     5    2  0      0     kworker/u:0
root     6    2  0      0     khelper
root     7    2  0      0     sync_supers
root     8    2  0      0     bdi-default
root     9    2  0      0     kblockd
root     10   2  0      0     rpciod
root     11   2  0      0     kworker/0:1
root     12   2  0      0     kswapd0
root     13   2  0      0     fsnotify_mark
root     14   2  0      0     crypto
root     25   2  0      0     mtdblock0
root     26   2  0      0     mtdblock1
root     27   2  0      0     mtdblock2
root     29   2  0      0     binder
root     30   2  0      0     deferwq
root     31   2  0      0     kworker/u:2
root     32   2  0      0     mmcqd/0
root     33   1  8780   540   /sbin/ueventd
root     35   2  0      0     jbd2/mtdblock0-
root     36   2  0      0     ext4-dio-unwrit
root     37   2  0      0     kworker/0:2
root     42   2  0      0     jbd2/mtdblock1-
root     43   2  0      0     ext4-dio-unwrit
root     48   2  0      0     jbd2/mtdblock2-
root     49   2  0      0     ext4-dio-unwrit
logd     50   1  14148  2148  /system/bin/logd
root     51   1  9824   348   /sbin/healthd
root     52   1  10612  1252  /system/bin/lmkd
system   53   1  9448   680   /system/bin/servicemanager
root     54   1  13908  1948  /system/bin/vold
system   55   1  43032  12108 /system/bin/surfaceflinger
root     57   1  9244   568   /system/bin/qemud
shell    60   1  9312   744   /system/bin/sh
root     61   1  12876  384   /sbin/adbd
root     62   1  18708  1344  /system/bin/netd
root     63   1  10100  1336  /system/bin/debuggerd
radio    64   1  14436  1360  /system/bin/rild
drm      65   1  17608  3476  /system/bin/drmserver
media    66   1  109524 7932  /system/bin/mediaserver
install  67   1  9404   696   /system/bin/installd
keystore 68   1  12488  1912  /system/bin/keystore
root     71   1  484048 44420 zygote
root     77   2  0      0     kauditd
system   338  71 588008 75072 system_server
media_rw 438  1  11300  696   /system/bin/sdcard
u0_a30   579  71 504812 32876 com.android.inputmethod.latin
radio    603  71 515660 39356 com.android.phone
u0_a7    623  71 503688 41652 com.android.launcher
u0_a2    688  71 499452 29072 android.process.acore
u0_a6    728  71 486184 21872 com.android.externalstorage
u0_a39   765  71 488892 23004 com.android.printspooler
u0_a12   781  71 527564 60096 com.android.systemui
u0_a5    846  71 490584 29028 android.process.media
u0_a17   884  71 496092 26012 com.android.calendar
u0_a21   904  71 490620 25828 com.android.deskclock
u0_a1    919  71 488408 25572 com.android.providers.calendar
system   943  71 486212 21820 com.android.keychain
u0_a4    963  71 492372 23060 com.android.dialer
u0_a8    984  71 487204 21920 com.android.managedprovisioning
u0_a9    1003 71 496916 26748 com.android.mms
system   1031 71 497660 23332 com.android.settings
u0_a25   1054 71 502344 30300 com.android.email
u0_a27   1070 71 493348 24456 com.android.exchange
u0_a33   1093 71 488056 24708 com.android.music
root     1126 61 9312   752   /system/bin/sh
root     1132 2  0      0     flush-31:1
root     1134 2  0      0     flush-179:0

root@generic:/ # exit
exit

This is nice. With this shell interface, I have full control of my Android emulator system now.

Last update: 2015.

Table of Contents

 About This Book

 Installing JDK 1.8 on Windows System

 Installation of Android SDK R24 and Emulator

 Installing Apache Ant 1.9 on Windows System

 Developing First Android Application - HelloAndroid

 Android Application Package (APK) Files

Android Debug Bridge (adb) Tool

 What Is Android Debug Bridge (adb)

 Commands and Options Supported by "adb"

 "adb install" and "adb uninstall" Commands

"adb shell" - Remote Shell Interface

 "adb push" and "adb pull" Commands

 Android File Systems

 Android 4.0.3 File Systems

 AboutAndroid - Application to Retrieve System Information

 android.app.Activity Class and Activity Lifecycle

 View Objects and Layout Resource Files

 Using "adb logcat" Command for Debugging

 Build Process and Package File Content

 Building Your Own Web Browser

 Android Command Line Shell

 Samsung Galaxy Tab 3 Mini Tablet

 USB Debugging Applications on Samsung Tablet

 Android Tablet - LG-V905R

 USB Debugging Applications on LG-V905R Tablet

 Android Phone - LG-P925g

 USB Debugging Applications on LG-P925g Phone

 Outdated Tutorials

 References

 PDF Printing Version