Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

grep command not found in adb shell

After my phone is connected to the computer through adb, going to adb shell and then typing grep gives me

grep: not found  

Is this a problem with my adb installation or my phone? How do I get grep to work for my device?

PS: This is the reason why I think it might a problem with my phone (as opposed to the adb installation)
https://stackoverflow.com/a/12143669/1693203
The answer says

The grep utility may not be installed on your device.

However, I may have misunderstood the statement. How do I get grep working?

like image 572
user13267 Avatar asked Dec 23 '14 06:12

user13267


2 Answers

grep command is not installed on your device by default. If you need to use grep command in your device, you can cross-compile busybox then invoke grep under busybox.

However if you are in Linux or Cygwin, you can pipe the command output and use the grep in PC to get result you want, e.g.

$ adb shell ps |grep google
app_5     279   71    200212 30928 ffffffff 00000000 S com.google.process.gapps
app_66    481   71    122804 21632 ffffffff 00000000 S com.google.android.apps.maps
app_66    32311 71    120200 20916 ffffffff 00000000 S com.google.android.apps.maps:NetworkLocationService
like image 106
alijandro Avatar answered Sep 24 '22 21:09

alijandro


in your case that means:The grep utility may is not be installed on your device.

install busybox from playstore then perform

busybox grep
like image 30
wgitscht Avatar answered Sep 21 '22 21:09

wgitscht