From android shell, is there a way I can edit a file?
In order to edit files like .rc
and similar scripts, I am currently using adb pull
to pull them, then edit them and then push them back adb push
. This is certainly inefficient.
Is there a way I can edit these files in android shell (like the vim editor in Linux shell)
I have root permissions on my device. So if necessary, I can install root applications.
You can create text files using:
adb shell
$ cat > filename.txt
You can add lines to a text files using:
$ cat >> filename.txt
Both commands can be terminated using ctrl-D
.
You can install BusyBox from the F-Droid store and if you have rooted your device you are able to use vi
to edit files.
adb shell
busybox vi /sdcard/Download/test.txt
A simplified version of vi for Android is contained in Busybox. Assuming you're running Windows, once you've installed Busybox (and you do need root permissions to do so), I recommend you follow the instructions at https://stackoverflow.com/a/29033010/5025060 to accomplish full screen text editing on your Android device from your Windows PC screen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With