- Known about the existence of logcat, dmesg, kmsg, and last_kmsg and have tried logging it at least once
- Know some basic knowledge of batch/bash(cmd/terminal)
- Using Windows OS(The problem only lies on Windows, so if you're using Mac or Linux then you're fine)
Although this is a rather technical article, but I will make it as simple as possible for all of the users to understand
Sometimes, I will see some of the developers will issue similar to this:
Log Commands with Grep
adb logcat | grep 'htc'
adb shell dmesg | grep 'mp_decision'
adb shell cat /proc/last_kmsg | grep 'mp_decision'
The problem is that if you're using a Windows OS, Windows OS doesn't have grep installed, so your command would not run and you will see an error message like this:
Linux or Mac users will not have this problem as they have grep installed, so they are fine.
1. Install a Linux shell on Windows
2. Use a terminal app within the Android phone
3. Connect to the linux shell inside the Android Phone by using your computer
4. Use the built-in filters(for logcat ONLY)
You can simply click here and follow the simple steps to get a linux shell on your computer
You just need to download a terminal app from your phone and every command will work fine. You would need to omit the adb and adb shell keyword(refer below) in order for the command to work. A nice terminal app suggestion would be https://play.google.com/store/apps/d...roidterm&hl=en which you can simply download from Google Playstore
You can just type "adb shell" and press enter, then type your commands(omit all adb and adb shell keyword) and it will work just as like in workaround #2.
1. "adb shell" + enter
2. Choose the command that you wanted:
logcat | grep 'htc'
dmesg | grep 'mp_decision'
cat /proc/last_kmsg | grep 'mp_decision'
This workaround is a workaround which only exists for logcat, because logcat have a filtering system that is built into it(makes us wonder why it is not built into dmesg and last_kmsg as well eh?).
For example, the grep command for the logcat above can be replaced by:
adb logcat htc:V *:S
For more information about the filtration, you can refer to http://developer.android.com/tools/d...gging-log.html
Hopefully, after reading this article, you will know how to deal with grep when you're on Windows OS
Do drop me a question or two if you have something that you don't understand and stay tuned for more articles!