21. Accessing Android Storage: termux-setup-storage Deep Dive
By default, Termux is isolated. To read or write files to your main Android internal storage (like your Downloads or Documents folders), you must grant explicit permission.
The Setup Command
Run the following command once:
bash $ termux-setup-storage
When executed, your Android OS will display a prompt asking for permission to access files. You must accept this permission.
Symlinks Created
This command does two things:
- It grants Android storage permissions to the Termux app.
- It creates a directory named
storagein your Termux home directory (~) containing symbolic links (shortcuts) to your main Android folders.
bash $ cd ~ $ ls -l ... drwxrwx--x 2 u0_a... u0_a... 4096 Jun 1 10:00 storage
$ cd storage $ ls dcims downloads external-1 movies music pictures shared
| Link Name | Points To (Android Folders) |
|---|---|
shared | The root of your internal shared storage. |
downloads | Your standard Android Downloads folder. |
dcims | Photos and Camera folders. |
Key Limitation
You only have access to shared storage areas (like Downloads). You cannot access the private data folders of other Android applications.