14

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.

  • You can try method mentioned in app help – beeshyams Jan 12 '17 at 9:40
  • 1
    To change to the default Download folder, use cd /storage/emulated/0/Download. – Death Mask Salesman Jan 12 '17 at 10:54
15

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
  • To whosoever edited my answer, good job. – Death Mask Salesman Nov 6 '17 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. – Roger Lipscombe Apr 23 '18 at 18:58
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.

protected by Community Nov 13 '17 at 15:06

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.