One thing sorely lacking from the default Android shell is command history. Here is a trick to enhance the Android shell:
1. Remount /system in read/write mode to allow changes:
mount -o remount,rw /system
2. Edit /etc/profile. Mine contains:
export PATH=/data/bin:$PATH
HOME=/sdcard
HISTFILE=~/.bash_history
use_color=true
alias ls='busybox ls --color=auto'
alias rm='rm -i'
alias cp='cp -i'alias mv='mv -i'
# Set up a ton of aliases to cover toolbox with the nice busybox# equivalents of its commands
for i in cat chmod chown df insmod ln lsmod mkdir mount mv rm rmdir rmmod umount; do
eval alias ${i}=\"busybox ${i}\"
done
unset i
alias ls='busybox ls --color=auto'
alias sysro='mount -o remount,ro /system'
alias sysrw='mount -o remount,rw /system'
Most of this was already in Cyanogenmod’s /etc/profile
3. Switch /system back to read-only:
mount -o remount,ro /system
This page had some interesting info. I was thinking of trying to get BASH as the default shell but it is not easy to do and anyhow because of its greater resource consumption may not really be advisable.
Adding /data/bin
to $PATH
as above is nice because you can conveniently put your own shell scripts there and it is read/write by default. Having the command history is extremely nice if you are working with the shell in Android often. The aliases sysro
and sysrw
are very useful also if you need to go in and hack /etc/profile
again.
Leave a Reply
You must be logged in to post a comment.