"If you can’t find your files, what’s the point of hacking?"
Let’s be real — installing tools in Termux is fun, but at some point, you’ll want to access your phone’s internal storage. Maybe you want to save scan results, open a text file, or even copy scripts between folders.
If that’s where you’re stuck, this post is for you.
📱 Why Termux Can’t Access Storage by Default
Android is built to protect your data. So, when you install Termux, it’s sandboxed — meaning it can’t see or touch your internal storage unless you explicitly allow it.
That’s why commands like ls /sdcard or saving files to ~/storage/downloads won’t work out of the box.
Let’s fix that.
✅ How to Access Storage in Termux (Step-by-Step)
1. Update your Termux first
pkg update && pkg upgrade
2. Grant storage permission
Termux has a built-in command to request storage access:
termux-setup-storage
After you run this, you’ll see a pop-up asking for permission. Tap "Allow".
This will create a storage folder in your Termux home directory that links to common Android storage paths.
📂 What You Get with termux-setup-storage
Once granted, Termux creates this structure:
~/storage/shared → Internal storage (/sdcard)
~/storage/downloads → Downloads folder
~/storage/dcim → Camera photos
~/storage/music → Music folder
~/storage/pictures → Pictures folder
You can now read, write, copy, and move files easily between Termux and your regular Android apps.
📁 Example: Saving Output to Downloads
Let’s say you want to save your Nmap results in a .txt file:
nmap 192.168.0.1 > ~/storage/downloads/scan.txt
Now you can open the scan.txt file from any file manager or even share it on Telegram — straight from your phone.
❗ Important Notes
- You only need to run
termux-setup-storageonce (unless you uninstall Termux). - This does not give you access to
/data/dataof other apps. That requires root. - If you're using Android 11 or later, file access may still be limited due to scoped storage. Stick to the provided
~/storagepaths.
🔄 Bonus Tip: Moving Files Between Termux and Android
Copy a file from Termux to Downloads:
cp myscript.sh ~/storage/downloads/
Or move a file from Downloads into Termux:
cp ~/storage/downloads/somefile.txt ~/
You can also mv, nano, or even cat any file within these directories.
🧠 Why This Matters
Accessing storage makes Termux 10x more useful. It turns your phone into a real mobile workstation. Now you can:
- Save tool outputs
- Read and edit scripts
- Share logs or reports
- Back up your configs
No root. No complex setup. Just one command and you’re ready.
💬 Need Help?
If you're still getting errors like Permission denied or No such file or directory, let me know in the comments. I’ll guide you through it.
Related Reads:
Stay curious, keep experimenting — and always stay ethical.
– Stephano | TerminalTools
Top comments (0)