BYTESLIP ← Back
Knowledge Base // Tutorial 56 · Termux

Give Termux Access to Shared Storage With termux-setup-storage

Difficulty: Medium ~10–15 min Termux · F-Droid

By default Termux cannot see your phone’s shared folders (Downloads, Photos, DCIM). termux-setup-storage asks Android for permission and creates handy links under ~/storage/. This is a deep dive—Medium only because Android 11+ permission quirks show up often.

termux-setup-storagetermux-setup-storage~/storage/shared · downloads · dcimGrant Files and media · then lsMEDIUM · SHARED STORAGE
Checklist // Before You Start

What You Need

Walkthrough // Steps

Grant storage and explore ~/storage

  1. Step 1: Run termux-setup-storage

    termux-setup-storage

    Built into Termux—no separate pkg install for this command. Android should show a permission dialog; tap Allow.

  2. Step 2: Confirm the symlink folder

    ls -la ~/storage

    Typical links (names can vary slightly by Android version):

    • shared — shared storage root (often /sdcard)
    • downloads — Downloads
    • dcim — camera / DCIM
    • pictures, music, movies — media folders
  3. Step 3: Browse and copy a file

    cd ~/storage/downloads
    pwd
    ls
    cd ~
    echo "hello from termux" > ~/note-from-termux.txt
    cp ~/note-from-termux.txt ~/storage/downloads/
    ls ~/storage/downloads/note-from-termux.txt

    Open the Files app → Downloads: you should see note-from-termux.txt. Import works the other way: cp ~/storage/downloads/some.pdf ~/.

  4. Step 4: Android 11+ “Permission denied”

    If ls ~/storage/shared fails after you thought you allowed access:

    1. Open system Settings → Apps → Termux → Permissions.
    2. Revoke Files and media / Storage, then grant it again (on some builds choose Allow management of all files if offered).
    3. Return to Termux and re-run termux-setup-storage.
  5. Step 5: Re-run safely

    Running termux-setup-storage again is fine—it recreates the symlinks if missing. If ~/storage never appears, fix permissions (step 4) first.

Pro Tip
Sources // Verified

Official docs

← All Tutorials Install Termux (F-Droid) Termux tutorials