Bourne Shell Command Line Examples

This section provides a quick introduction of the Bourne shell which is the default shell on the Android system, which is based on the Linux system, which is based on Unix system.

Below is an example of Bourne shell session on my Android emulator. Explanations are provided in "()" below the output of the command.

herong> adb shell
#
      (Starting a Bourne shell session on the Android emulator)

# set
set
ANDROID_ASSETS=/system/app
ANDROID_BOOTLOGO=1
ANDROID_DATA=/data
ANDROID_PROPERTY_WORKSPACE=8,0
ANDROID_ROOT=/system
ASEC_MOUNTPOINT=/mnt/asec
BOOTCLASSPATH=/system/framework/core.jar:/system/framework/core-ju...
ANDROID_STORAGE=/storage
IFS='
'
LD_LIBRARY_PATH=/vendor/lib:/system/lib
LOOP_MOUNTPOINT=/mnt/obb
OPTIND=1
PATH=/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
PS1='# '
PS2='> '
PS4='+ '
      (Displays the values of all shell variables)

# PS1=\$
PS1=\$
$
      (Sets the shell prompt to the dollar sign $)

$ cd /sdcard/Download
cd /sdcard/Download
      (Changes directory to /sdcard/Download)

$ D=`pwd`
D=`pwd`
      (Sets the current working directory to variable D)

$ echo $D
echo $D
/sdcard/Download
      (Displays the value in variable D)

$ date
date
Sub Mar  1 22:20:19 GMT 2015
      (Displays the date)

$ cat > myself
cat > myself
I am trying to learn Android systems
I am trying to learn Android systems
^D
      (Creates a file and lets you to enter some text)

$ ls -l
ls -l
----rwxr-x system   sdcard_rw       36 2015-03-01 22:24 myself
      (Lists the contents of the current directory in long format)

$ cat myself
cat myself
I am trying to learn Android systems
      (Displays the contents of "myself" on the screen)

$ mkdir test
mkdir test
      (Makes a new directory)

$ touch test/myfile
touch test/myfile
      (Touches a file - Creates a new empty file)

$ rm test/myfile
rm test/myfile
      (Removes a file)

$ rmdir test
rmdir test
      (Removes a directory)

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

 What Is the Bourne Shell?

Bourne Shell Command Line Examples

 Unix/Linux Command Line Programs

 Android Command Line Tools

 "dalvikvm" Command to Run Java Application

 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

 References

 Full Version in PDF/EPUB