Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I edit files inside the Android ADB shell?

Tags:

android

editor

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.

like image 557
Sandeep Avatar asked Nov 28 '13 05:11

Sandeep


3 Answers

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.

like image 190
Deepak Negi Avatar answered Nov 16 '22 11:11

Deepak Negi


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
like image 26
Veener Avatar answered Nov 16 '22 12:11

Veener


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.

like image 6
CODE-REaD Avatar answered Nov 16 '22 13:11

CODE-REaD