3

I just installed Wget using Termux on my Android. But, when I download a file, I cannot find it's location. Can anyone please tell me where it's located? And how can I change that location to my desired directory?

  • 2
    wget usually downloads to where you called it from – unless told otherwise using the -O parameter. So you either first cd to the desired directory – or try something like wget -O /sdcard/downloads/foo.zip http://example.com/foo.zip. – Izzy Jan 25 '17 at 8:15
  • @DeathMaskSalesman I'm not rooted. So, is there any way that would allow me to delete the file or at least copy or move it? – SinTan1729 Jan 25 '17 at 9:17
5

To quote Izzy,

wget usually downloads to where you called it from – unless told otherwise using the -O parameter. So you either first cd to the desired directory – or try something like wget -O /sdcard/downloads/foo.zip http://example.com/foo.zip.

In your case, this directory is /data/data/com.termux/files/home and, as it's inside /data, only root and the files' owner can alter things here.

Since Termux is the owner, though, you can move, copy and delete files and folders inside the abovementioned directory.


Before moving or copying to the internal storage

If you run Android Marshmallow (6.x) or above, run termux-setup-storage and grant the requested permission to be able to interact with anything inside /storage/emulated/0.


To move files

To move files to e.g. the standard download directory, use the command mv source destination, replacing source with the file you wish to move, and destination with /storage/emulated/0/Download, which is the default download directory located in your internal storage.


To copy files

To copy files to e.g. the standard download directory, use the command cp source destination, replacing source with the file you wish to move, and destination with /storage/emulated/0/Download.


To delete files

To delete any file, use rm file, replacing file with the file you wish to delete.


To delete directories

To delete an empty directory, use rmdir directory.

To delete a non-empty directory, use rm -r directory. This method will delete anything inside the chosen directory.

In both cases, replace directory with the directory you wish to delete.

| improve this answer | |
0

Type echo $HOME in Termux. That is the current wget location.

| improve this answer | |
  • 2
    The HOME variable does not reflect the current location. If OP cded somewhere else, echo $HOME would've shown /data/data/com.termux/files/home nonetheless, thus giving a correct result to a wrong question. To know the current directory, use either pwd or echo $PWD. – Grimoire Jan 26 '17 at 19:41
  • Yap wget works at working directory. However the screenshot is valid :D – amigo Jan 27 '17 at 4:46

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