25

I discovered that the files and directory that are created in (default) Termux, are not accessible to other apps on non-rooted phones.

Where is the folder that Termux defaults to?

How do I set it to use a folder / filespace that I can access through an app like ES File Explorer?

Or perhaps slightly differently, how in Termus would I change to, let's say, the default "Download" folder?

Cheers.

3
  • You can try method mentioned in app help
    – beeshyams
    Jan 12, 2017 at 9:40
  • 1
    To change to the default Download folder, use cd /storage/emulated/0/Download.
    – Grimoire
    Jan 12, 2017 at 10:54
  • You can also access the default storage location. Navigate to the folder Android and then to data. From there you should be staring at com.termux.
    – Nate T
    Jan 2, 2021 at 6:43

2 Answers 2

30

From within Termux itself, you can change the current directory to the internal storage, by means of

cd /storage/emulated/0

or

cd /sdcard

followed by enter. After that, create a new directory by using

mkdir Directory

and replace Directory with a name of your choice. You'll then have a new directory in your device's internal storage, whose data you'll be able to access with any file manager.


Notes concerning Marshmallow and above

If your device is running Android 6 or newer, you'll need to run the command

termux-setup-storage

from within Termux, and then accept the request to write to the storage, in order for Termux to be able to perform directory and file creation.

The termux-setup-storage command creates a new directory in your $HOME or ~/ directory named storage. This new directory contains a few symlinks to /storage/emulated/0 listed below:

dcim -> /storage/emulated/0/DCIM
downloads -> /storage/emulated/0/Download
external-1 -> /storage/external_sd/Android/data/com.termux/files
movies -> /storage/emulated/0/Movies
music -> /storage/emulated/0/Music
pictures -> /storage/emulated/0/Pictures
shared -> /storage/emulated/0

Therefore, you can run the following commands to create /storage/emulated/0/Directory described above with a little less typing now:

cd ~/storage/shared
mkdir Directory
3
  • 1
    To whosoever edited my answer, good job.
    – Grimoire
    Nov 6, 2017 at 17:26
  • 1
    If you're using (Android) termux on a Chromebook, the external storage doesn't appear to be available (in the current version of Android for Chromebook). I used the built-in file explorer to copy my files to 'Downloads', and then, in termux, I could copy them from /sdcard/Download to $HOME. Apr 23, 2018 at 18:58
  • According to Termux wiki Android 11 users may face to a Permission denied error after all this steps. Refer to the wiki for workaround.
    – MortezaE
    Jul 14, 2021 at 13:23
1

See https://wiki.termux.com/index.php?search=Storage for the newest information about using storage in Termux. https://wiki.termux.com/wiki/Termux-setup-storage is the prerequisite. Use it first. To share data see https://wiki.termux.com/wiki/Sharing_Data for more information.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .