Setting up a Terminal Environment in Android

Executive Summary and Motivation

This article is a work in progress and largely a pre-requisite for my other article on getting Debian running alongside Android. Check back soon I'll be adding things to this page.

Pre-requisites

  • a rooted Android device

Install Jackpal

Jackpal is a nice little open source terminal emulator.

Setting up Busybox on Android

You may already have busybox installed if you are running a a custom image. Test by opening up a terminal and running the 'which' command which will tell you where in your PATH you have it:

$ which busybox
/system/xbin/busybox

If you don't get a result, let's double check your PATH variable (this is where your shell looks to find programs for the commands you type in):

$ echo $PATH
/data/local/bin:/system/bin:/system/xbin

# You may even want to try setting your path, or it extending it with this:

$ PATH=$PATH:/system/bin:/system/xbin:/data/local/bin
$ which busybox

FIX HERE: Once you've located busybox

BB_CMDS="[ [[ acpid add-shell addgroup adduser adjtimex arp arping ash awk
         base64 basename beep blkid blockdev bootchartd brctl bunzip2 bzcat
         bzip2 cal catv chattr chgrp chpasswd chpst chroot chrt chvt cksum
         clear comm cp cpio crond crontab cryptpw cttyhack cut dc deallocvt
         delgroup deluser depmod devmem dhcprelay diff dirname dnsd
         dnsdomainname dos2unix du dumpkmap dumpleases echo ed egrep eject
         env envdir envuidgid ether-wake expand expr fakeidentd false fbset
         fbsplash fdflush fdformat fdisk fgconsole fgrep find findfs flock
         fold free freeramdisk fsck fsck.minix fsync ftpd ftpget ftpput fuser
         getopt getty grep gunzip halt hdparm head hexdump hostid hostname
         httpd hush hwclock ifdown ifenslave ifplugd ifup inetd init install
         iostat ipaddr ipcalc ipcrm ipcs iplink iproute iprule iptunnel
         kbd_mode killall killall5 klogd last length less linux32 linux64
         linuxrc loadfont loadkmap logger login logname logread losetup lpd
         lpq lpr lsattr lspci lsusb lzcat lzma lzop lzopcat makedevs makemime
         man md5sum mdev mesg microcom mkdosfs mke2fs mkfifo mkfs.ext2
         mkfs.minix mkfs.vfat mknod mkpasswd mkswap mktemp modinfo modprobe
         more mountpoint mpstat mt nameif nbd-client nc nice nmeter nohup
         nslookup ntpd od openvt passwd patch pgrep pidof ping6 pipe_progress
         pivot_root pkill pmap popmaildir poweroff powertop printf pscan pwd
         raidautorun rdate rdev readahead readlink readprofile realpath
         reformime remove-shell reset resize rev rpm rpm2cpio rtcwake
         run-parts runlevel runsv runsvdir rx script scriptreplay sed sendmail
         seq setarch setfont setkeycodes setlogcons setsid setuidgid sha1sum
         sha256sum sha512sum showkey slattach smemcap softlimit sort split
         start-stop-daemon stat strings stty sulogin sum sv svlogd swapoff
         swapon switch_root sysctl syslogd tac tail tar tcpsvd tee telnet
         telnetd test tftp tftpd time timeout tr traceroute traceroute6 true
         tty ttysize tunctl udhcpc udhcpd udpsvd uname unexpand uniq unix2dos
         unlzma unlzop unxz unzip usleep uudecode uuencode vconfig vi vlock
         volname wall watch watchdog wc wget which who whoami xargs xz xzcat
         yes zcat zcip"

su
mount -o remount,rw / /
for cmd in BB_CMDS; do
  if [ ! -f /system/bin/$cmd ]; then
    ln -s /system/xbin/busbybox /system/bin/$cmd
    chown root.shell /system/bin/$cmd
    chmod 755 /system/bin/$cmd
  else
    echo "$cmd already exists in /system/bin, skipping."
  fi
done
mount -o remount,ro / /

Getting Terminal Copies of ssh/scp

Go grab these from Cyanogenmod or some distro where they are compiling them against the same libraries as stock Android.

Keys or Shortcuts working and not working

Works: Esc - keyboard back key ^k - clear to end of line ^w - clear prior word ^u - clear entire prior line

Does not work: ^left or right - does not work

Android Command Line Utilities

pm

<find my links to good resources>