Back to course

Accessing Android Storage: termux-setup-storage Deep Dive

Termux Masterclass: From Zero to Linux Power User on Android

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:

  1. It grants Android storage permissions to the Termux app.
  2. It creates a directory named storage in 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 NamePoints To (Android Folders)
sharedThe root of your internal shared storage.
downloadsYour standard Android Downloads folder.
dcimsPhotos 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.