(Phone to PC/Mac/Linux). This guide will show you how to transfer files, folders, and directories between your Android phone and a computer using Termux, all over your local WiFi.
This method turns your phone into a secure file server (SFTP) that you can access from any computer with a file transfer client. You get a full file browser and can drag-and-drop files in both directions (upload and download).
Update and Install Packages:
Open Termux and run the following commands to make sure everything is up-to-date and to install OpenSSH, which provides the server.
pkg update && pkg upgrade -y
pkg install openssh -y
Set Your Password:
You need to create a password for the connection. This is not your phone's lock screen password; it's a new password just for Termux.
passwd
Enter your new password twice. (You won't see any characters as you type).
Grant Storage Access (Crucial!):
To access your phone's "Internal Storage" (like your Downloads, DCIM, and Pictures folders) from your computer, you must give Termux permission.
termux-setup-storage
Your phone will pop up a permission request. Accept it. This creates a new folder in Termux's home directory called storage, which is a symbolic link to your phone's files.
Find Your Connection Details (Username & IP):
You need two pieces of information for your computer to find your phone.
To find your Username, run:
whoami
The output will be something like u0_a123 or similar. Write this down.
To find your Phone's IP Address, run:
ip addr show wlan0
Look for the line that says inet. You'll see your phone's local WiFi IP address. Write this down.
Start the Server:
Now, simply start the SSH server.
sshd
The server is now running in the background.
If you just want to quickly download some files from your phone to your computer and don't want to install software, this is a great option.
On your phone (in Termux):
Install Python (if you don't have it):
pkg install python
Navigate to the folder you want to share. For example, to share your main Downloads folder:
cd ~/storage/downloads
Start the simple web server:
python -m http.server 8000
On your computer:
To stop this server, just go back to Termux and press Ctrl + C.