Archived: "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.

This tutorial was based on Android SDK R17 with Android 4.0.3 and left here as a reference.

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 emulator:

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

# ls -l
ls -l
drwxr-xr-x root   root         2012-04-01 acct
drwxrwx--- system cache        2012-04-01 cache
dr-x------ root   root         2012-04-01 config
lrwxrwxrwx root   root         2012-04-01 d -> /sys/kernel/debug
drwxrwx--x system system       2012-04-01 data
-rw-r--r-- root   root     116 1970-01-01 default.prop
drwxr-xr-x root   root         2012-04-01 dev
lrwxrwxrwx root   root         2012-04-01 etc -> /system/etc
-rwxr-x--- root   root   98676 1970-01-01 init
-rwxr-x--- root   root    2344 1970-01-01 init.goldfish.rc
-rwxr-x--- root   root   17040 1970-01-01 init.rc
drwxrwxr-x root   system       2012-04-01 mnt
dr-xr-xr-x root   root         1970-01-01 proc
drwx------ root   root         2011-11-14 root
drwxr-x--- root   root         1970-01-01 sbin
lrwxrwxrwx root   root         2012-04-01 sdcard -> /mnt/sdcard
drwxr-xr-x root   root         1970-01-01 sys
drwxr-xr-x root   root         2011-12-14 system
-rw-r--r-- root   root     272 1970-01-01 ueventd.goldfish.rc
-rw-r--r-- root   root    3825 1970-01-01 ueventd.rc
lrwxrwxrwx root   root         2012-04-01 vendor -> /system/vendor

# cat default.prop
cat default.prop
#
# ADDITIONAL_DEFAULT_PROPERTIES
#
ro.secure=0
ro.allow.mock.location=1
ro.debuggable=1
persist.sys.usb.config=adb

# df
df
Filesystem             Size   Used   Free   Blksize
/dev                   252M    32K   252M   4096
/mnt/asec              252M     0K   252M   4096
/mnt/obb               252M     0K   252M   4096
/system                161M   161M     0K   4096
/data                  124M    13M   110M   4096
/cache                  64M     1M    62M   4096
/mnt/sdcard            126M   907K   125M   512
/mnt/secure/asec       126M   907K   125M   512

# ps
ps
USER    PID PPID VSIZE  RSS     WCHAN    PC         NAME
root     1   0    276    192   c0099f1c 000086e8 S /init
root     2   0    0      0     c004df64 00000000 S kthreadd
root     3   2    0      0     c003fa28 00000000 S ksoftirqd/0
root     4   2    0      0     c004abc0 00000000 S events/0
root     5   2    0      0     c004abc0 00000000 S khelper
root     6   2    0      0     c004abc0 00000000 S suspend
root     7   2    0      0     c004abc0 00000000 S kblockd/0
root     8   2    0      0     c004abc0 00000000 S cqueue
root     9   2    0      0     c0178c7c 00000000 S kseriod
root     10  2    0      0     c004abc0 00000000 S kmmcd
root     11  2    0      0     c006efa8 00000000 S pdflush
root     12  2    0      0     c006efa8 00000000 S pdflush
root     13  2    0      0     c0073480 00000000 S kswapd0
root     14  2    0      0     c004abc0 00000000 S aio/0
root     24  2    0      0     c01764ac 00000000 S mtdblockd
root     25  2    0      0     c004abc0 00000000 S kstriped
root     26  2    0      0     c004abc0 00000000 S hid_compat
root     27  2    0      0     c004abc0 00000000 S rpciod/0
root     28  2    0      0     c0193fd0 00000000 S mmcqd
root     29  1    252    156   c0099f1c 000086e8 S /sbin/ueventd
...

# exit
exit

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

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

 Android 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

Archived Tutorials

 Archived: Downloading and Installing JDK 1.7

 Archived: Downloading and Installing Android SDK R17

 Archived: Running Android SDK Manager

 Archived: Installing Android Platform 4.0.3 and Libraries

 Archived: Verifying Android Platform Installation

 Archived: Creating Android Virtual Device (AVD)

 Archived: Launching Android Emulator in AVD Manager

 Archived: Android Emulator Built-in Applications

 Archived: Android Emulator Built-in Web Browser

 Archived: Downloading and Installing Apache Ant 1.8

 Archived: "HelloAndroid" - First Android Project

 Archived: Building the Debug Binary Package

 Archived: Installing the Debug Binary Package

 Archived: Running the Debug Binary Package

 Archived: Rebuild the Debug Binary Package

 Archived: Redefine Text in Resource Files

 Archived: Installing Android PDF Viewer APK File

 Archived: Copy PDF File to Android Emulator's File System

 Archived: Installing Adobe Reader APK File

Archived: "adb shell" - Remote Shell Interface

 Archived: "adb push" and "adb pull" Commands

 References

 Full Version in PDF/EPUB