How to open the file in the shared folder via termux and edit it in the external app? #4262
Replies: 1 comment
-
Hello dear To edit files in Termux (especially those in shared storage) without encountering permission issues, there are a few options you can try:
If using an external editor causes problems, you can edit files directly within Termux using editors like nano, vim, or emacs. This completely resolves the permission issue. It might be more convenient to use the command-line text interface instead of trying to use an external editor.
If you are determined to use an external editor, you can follow these steps to ensure you have the necessary permissions: Set Up RUN_COMMAND: You can set the RUN_COMMAND permission to be able to write to shared storage. You will need to add the following line in the Termux settings file: termux-setup-storage After that, run the following command to update the permissions: termux-open ~/storage/shared/notes/file.org
You can also use termux-share to share content with an external editor: termux-share -a edit ~/storage/shared/notes/file.org Make sure that the app you are using to edit files supports editing files sent via Intent.
Use a file manager app on your device (like Files by Google or any other app) to navigate to the Termux folder in shared storage, and then you can open file.org in your preferred editor.
Look for text editing apps that support editing files in shared storage, such as Jota Text Editor or QuickEdit. Ensure that these apps have the necessary permissions to access storage. Conclusion While there may be different ways to edit files, it is usually best to use a text editor within Termux to avoid permission problems. If you prefer using an external editor, make sure to adjust the permissions as outlined above. If you have any further questions or need more assistance, feel free to ask. |
Beta Was this translation helpful? Give feedback.
-
I run
termux-open ~/storage/shared/notes/file.org
and thefile.org
opens in the external editor. Then I want to edit it and save but I got the errorPermission Denial: writing ... uri .... requires RUN_COMMAND or grantUriPermission
.I am ready to continue with
RUN_COMMAND setup
as outlined below but still I wanted ask if I don't miss something. Is there easier way to edit the file (in the shared storage) opened via termux?It seems to me as very common use-case to send the file (in the shared storage) to external editor to edit it (I have a folder with many notes, I use
ripgrep
andfzf
to find the relevant note which I d' like to open and occasionally edit).To do my homework I investigated a bit
termux-open
gives the read permission, there are different kind of storage with different access rights, I need to setup RUN_COMMAND Intent if I like to write with other app to the termux Internal storageRUN_COMMAND
permission in termux instead of the calling app #3766)termux-share -a edit ~/storage/shared/notes/file.org
or someam
commands without succesI can of course edit the file in shell editor which I do (in
emacs, nano
) but the external editor (orgro
) is more pleasant on the mobile screen.Beta Was this translation helpful? Give feedback.
All reactions