Join WhatsApp
Join Now
Join Telegram
Join Now

Termux storage setup command

By Termux Apk

Published on:

Termux storage setup command

Allow me to share with you one of the most vexing issues I encounter when developers use Termux. You’re feeling productive while coding, and then all of a sudden you run into a wall. When you try to access the files on your phone, you get the dreaded “Permission denied” error.

Does that sound familiar? You’re not by yourself. After hours of troubleshooting scripts that ought to function flawlessly, I’ve discovered that the problem is simply with storage permissions. I’m going to permanently spare you that headache today.

Why This Happens (And It’s Not Your Fault)

Here’s the thing: Android changed the game. Remember when apps could just access everything? Yeah, those days are gone. Now, Termux needs explicit permission to touch your files.

When you first install Termux and try something simple like:

ShellScript
ls /sdcard/Download

Or:

ShellScript
cp myscript.sh /storage/emulated/0/

You’ll probably see this beauty:

ShellScript
bash: /storage/emulated/0/: Permission denied

That’s Android 10+ saying “Hold up, you need permission first.” It’s like showing up to a party without an invitation.

The Real-World Impact (Trust Me, I’ve Been There)

Let me paint you a picture. You’re working on an automation script to backup your photos. You’ve got the code perfect, tested it in your home directory… but the moment you try to grab your actual photos? Nothing. Nada. Zilch.

Or worse—you’re trying to share a file you just created with another app, and you realize you’re stuck in Termux’s little sandbox. No way out.

The frustration is real. I’ve seen developers:

  • Abandon entire projects because they couldn’t figure out file access
  • Resort to manual file copying through the file manager (the horror!)
  • Spend hours on Stack Overflow looking for complex workarounds

The good news is that there is an absurdly easy solution.

The All-Fixing Magic Command

Are you prepared for this? It’s just one command. Seriously.

Step 1: Run This Once and Forget About It

ShellScript
termux-setup-storage

That’s it. When you run this, Android will pop up a permission dialog. Just tap “Allow” and you’re golden.

Step 2: Double-Check It’s Working

ShellScript
ls ~/storage/shared

If you see your Downloads folder, DCIM, and all your usual Android directories, you’re in business.

Step 3: Understand What Just Happened

Termux just created a bunch of shortcuts for you. Think of them like bookmarks to your phone’s important folders:

  • ~/storage/shared — Your main phone storage
  • ~/storage/downloads — Exactly what it sounds like
  • ~/storage/dcim — All your camera photos
  • ~/storage/pictures — Screenshots and saved images
  • ~/storage/music — Your tunes
  • ~/storage/movies — Videos and recordings

These aren’t copies—they’re direct links. Move a file there, and it’s instantly available to any other app on your phone.

Real Examples You Can Use Right Now

Want to copy a file from Downloads to your Termux projects?

ShellScript
cp ~/storage/downloads/somefile.txt ~/my_projects/

Need to move your Python script output back to Downloads?

ShellScript
mv output.zip ~/storage/downloads/

Pro tip: I keep this command handy for backing up my photos:

ShellScript
cp -r ~/storage/dcim ~/backup/dcim_photos

When Things Go Wrong (And How to Fix Them Fast)

Even with the magic command, sometimes things get weird. Here’s your troubleshooting toolkit:

Problem: Still getting “Permission denied”
Quick fix: Close Termux completely and reopen it. Android sometimes needs a refresh.

Problem: “~/storage” folder is missing
Just delete it and recreate:

ShellScript
rm -rf ~/storage
termux-setup-storage

Problem: Using Android 13 and nothing works
Check your settings: Settings → Apps → Termux → Permissions → Files and media → Allow all the time

The Setup I Wish Someone Told Me About

Here’s what I do to make sure I never have storage issues again:

  1. Always use the symlinks. Don’t try to access /sdcard/ directly
  2. Keep a permission checker. I add this to my .bashrc:
    # Check storage setup
    if [ ! -d "$HOME/storage" ]; then
    echo "⚠️ Setting up Termux storage..."
    termux-setup-storage
    fi

  3. Update Termux regularly. The F-Droid version gets all the latest fixes

Performance Reality Check

Here’s the honest truth: once properly set up, file operations are blazing fast. I’m talking 30-80MB/s on a decent phone. Copying a 1GB video? Takes about 15-30 seconds.

The symlinks don’t slow anything down. It’s like having a shortcut on your desktop—same speed, just easier to access.

Quick Developer FAQ

Do I need to run termux-setup-storage every time?

Nope! Once is enough. Think of it like installing a plugin—it just works after that.

Can I access my SD card too?

Sometimes. Look for ~/storage/external-1. If it’s there, great! If not, your SD card might not be mounted or supported.

What Termux version should I use?

Get the latest from F-Droid. The Play Store version is ancient and will cause headaches.

Bottom Line

Storage access in Termux isn’t complicated—it just needs to be done once, correctly. Run termux-setup-storage, grant permissions, and you’re set for life.

Don’t be like past me, spending hours on complex workarounds when the solution was one command away. Get this setup right once, and you’ll never think about file permissions again.

Now go forth and build something awesome. Your files are waiting for you.

Termux APK is a passionate open‑source developer and Linux lover who’s been tinkering with Android terminals for over seven years. When not experimenting with new packages or debugging builds, they’re sharing friendly, step‑by‑step guides on Termux.in to help you get the most out of your Android command line. Trustworthy, hands‑on, and always eager to explore—Termux APK is here to make your mobile Linux journey as smooth (and fun!) as possible.

Leave a Comment