Friday, June 14, 2019

Access Your Android Phone's Storage, using Commands

There are a lot of apps for android, that enable file sharing over wifi. Some of them are free, and some of them are paid. But in this article, I will be sharing a kind of geek way on how to share your android phone's internal storage with your linux machine.

Install an app called termux from the play store. Download the app here: https://play.google.com/store/apps/details?id=com.termux . This app will add terminal emulation to your android

Once installed, allow termux to access to storage. You can do that by going to Settings --> Apps & Notifications --> Termux --> Permissions, and enable Storage

Optional: to make your typing experience better, I recommend this keyboard app: https://play.google.com/store/apps/details?id=org.pocketworkstation.pckeyboard

The http server of our choice is, the python's simple-http server. To use the simple-http, first you need to install python. Run below in your termux console
$ pkg install python -y

Get your phone's ip address. This can be easily done in termux
$ ip a | grep wlan0

Run http.server, to share your phone's internal storage over the wifi. /storage/emulated/0 is the default root directory for android phone's internal storage
$ python -m http.server /storage/emulated/0 

In your PC/laptop/other android, just use a browser to access the phone, via port 8000

No comments: