Posts

Showing posts from April, 2011

kernel logs android

If you want to extract kernel logs from the android shell and are getting 'Permission Denied' errors, you can use this approach: Go into the adb shell and run: cat /proc/last_kmsg >/sdcard/last_kmsg. Now come out of the shell and run: adb pull /sdcard/last_kmsg This will extract the logs to the folder containing the adb exe!

Grep

Let's say you want to search for the text 'amigo' within a directory. You can use: grep -r 'amigo' /home/guest/mydir. If you start getting errors like 'No such file or directory' and you want to ignore them, the option -s can be used. So it'll become grep -r  -s 'amigo' /home/guest/mydir. Here -r is for recursive search within a directory and -s for skipping error messages. And if we want to exclude searching certain type of files, like SVN and xml files, we can use: grep -r -s -n --exclude=*.{svn*,xml} 'PATTERN' . Another useful feature is if we want to exclude certain directories from the search altogether. For this we can use  --exclude-dir=Tests .