Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I can simulate "tail" command for file on the Android file system?

Tags:

android

adb

I have file on SD-CARD and my app using it as log file. Is it possible through the adb to watch file with all changes in real time? Like with tail -f /sdcard/myfile.log command.

like image 474
vochupin Avatar asked Jun 02 '10 11:06

vochupin


People also ask

How do I paste into adb shell?

As you would just "CTRL+V" on windows, I just need to "CTRL+V" on Android if you know what I mean. Not directly through adb. If you have root, you could create a background system service that responds to an intent, and upon receiving the intent, inject a key sequence equivalent to paste (Ctrl + V).

How do I open adb from command prompt?

Open a command window in the folder by holding shift and right-clicking in an empty spot in the folder and selecting "Open command prompt/PowerShell here" in the menu. Then you can start using ADB — connect your phone and try . ADB devices to see if it's working. A list with attached devices should show up.

How do I exit adb shell?

To exit adb and return to the system shell use the $q or $Q command. To stop the debugger press <Ctrl>D. NOTE: adb cannot be stopped by pressing the Quit or Interrupt key.


1 Answers

This seems to work great for me:

adb shell "while true; do cat; sleep 1; done < /sdcard/myfile.log"
like image 141
Jesse Avatar answered Oct 22 '22 13:10

Jesse