How to install “grep” into /system/bin directory?

My Xperia Arc S comes with toolbox, not busybox, as the wrapper utility for all the Linux command. I am not sure if toolbox has “grep” utility or not, but busybox has.

Trivial problem, but nevertheless documented here for future references:

Assuming rooted Android.

Download the busybox, one version is found in the zergRush rooting guide V3 from (

Now “su” as root and all remaining operation are executed as root.

Put it into /data/tmp directory.

chmod 455 /data/tmp/busybox
# ls -l /data/tmp/busybox
-r--r-xr-x shell shell 1075144 2012-01-02 13:17 busybox
# /data/tmp/busybox mount -o remount,rw /system

# /data/tmp/busybox grep
BusyBox v1.18.4 (2011-04-04 18:40:20 CDT) multi-call binary.

Usage: grep [-HhnlLoqvsriwFE] [-m N] [-A/B/C N] PATTERN/-e PATTERN.../-f FILE [FILE]...

Search for PATTERN in FILEs (or stdin)

-H Add 'filename:' prefix
-h Do not add 'filename:' prefix
-n Add 'line_no:' prefix
-l Show only names of files that match
-L Show only names of files that don't match
-c Show only count of matching lines
-o Show only the matching part of line
-q Quiet. Return 0 if PATTERN is found, 1 otherwise
-v Select non-matching lines
-s Suppress open and read errors
-r Recurse
-i Ignore case
-w Match whole words only
-F PATTERN is a literal (not regexp)
-E PATTERN is an extended regexp
-m N Match up to N times per file
-A N Print N lines of trailing context
-B N Print N lines of leading context
-C N Same as '-A N -B N'
-e PTRN Pattern to match
-f FILE Read pattern from file

cat /data/tmp/busybox > /system/bin/busybox
chmod 455 /system/bin/busybox
cd /system/bin
ln -s busybox grep
chmod 455 grep



Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: