[HowTo] transfer files from one Linux machine to another with existing tools
Recently, I was tasked to switch laptops. I had to quickly transfer files from one Linux machine to another Linux machine. They both run Ubuntu 20.04 and are connected to the same WiFi router.
At first, I thought it would be a piece of cake to transfer everything via SSH. I then realised I’d then need to install an SSH server and I din’t want to install anything. Upon googling, I found a super-easy way to transfer files with just the existing tools.
On the host machine, just invoke a terminal and run the below command on the directory that you wanted to transfer:
python3 -m http.server
I wanted to move my home directory contents and thus ran this command under ~(/home/username). I can now access my whole home directory via basic HTTP on port 8000.
jeyanthan@jey-dell:~$ python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
On the other machine, just open a browser and access the local IP address of the old machine and you get to see everything under the respective directory like below:
You may then use wget
to download them all at once like below:
$ wget -r -v http://192.168.122.1:8000/
Note: This is single-threaded and you cannot do parallel downloads. wget
should get it all sequentially.