Setting up storage in Termux is an essential step if you want to access files and directories on your Android device. By enabling storage access, you can use Termux to manage files, download content, and interact with your device’s internal or external storage. This guide will walk you through the process simply and straightforwardly.
Why Set Up Storage in Termux?
- Access your Android device’s internal storage directly from Termux.
- Use Termux to create, edit, or delete files in your device’s storage.
- Download files and save them in your device’s folders.
- Share files between Termux and other apps.
Step-by-Step Guide to Setup Storage in Termux
Step 1: Install and Open Termux
- Download Termux from the F-Droid.
- Launch the Termux app.
Step 2: Grant Storage Permission
To access storage, you need to grant Termux permission to use your device’s storage.
Run the following command in Termux:
termux-setup-storage
You will see a pop-up asking for permission. Click Allow to grant access to your storage.
Step 3: Verify Storage Access
After granting permission, a directory named storage
will be created in your Termux home directory. This directory contains symbolic links to various storage locations on your device.
Run the following command to list the contents of the storage
directory:
ls storage
You should see the following directories:
- dcim: Shortcut to your device’s camera folder.
- downloads: Access to your device’s Downloads folder.
- movies: Shortcut to your Movies folder.
- music: Shortcut to your Music folder.
- pictures: Shortcut to your Pictures folder.
- shared: Access to all files in your shared internal storage.
Using Termux Storage
1. Navigate to a Specific Folder
To navigate to your shared storage (internal storage):
cd storage/shared
To navigate to your Downloads folder:
cd storage/downloads
2. Create Files in Storage
You can create files in any storage directory. For example, to create a text file in Downloads:
cd storage/downloads
echo "Hello, Termux!" > example.txt
3. Delete Files
To delete a file, use the rm
command. For example:
rm example.txt
4. Move or Copy Files
Move a file from your Termux home directory to Downloads:
mv myfile.txt storage/downloads/
Copy a file instead of moving:
cp myfile.txt storage/downloads/
Conclusion
Setting up storage in Termux is quick and easy, allowing you to use the terminal to manage files on your Android device seamlessly. With storage access enabled, you can create, edit, move, and delete files, making Termux a powerful tool for both casual users and developers.
If you face any issues, double-check the permissions or consult the Termux community for support.
Happy exploring with Termux!