Blog / The Fastest Way to Transfer Files on Linux (Stop Using SCP)
Linux, DevOps, Bash, Performance

The Fastest Way to Transfer Files on Linux (Stop Using SCP)

naveed Root User
Feb 12, 2026 5 Min Read Intermediate

Moving gigabytes of data between servers is a daily task for Data Engineers. While scp is the muscle memory command for most, it is inefficient, lacking in features, and surprisingly slow over high-latency networks.

Whether you are deploying a scraper to a fresh droplet or migrating a database dump between regions, you need speed. Here are the most performant methods for the three most common transfer scenarios.

Scenarios 1 & 2: Local ↔ Remote

For transferring files between your laptop and a server (in either direction), rsync is the undisputed king. Unlike scp, it uses a smart "delta-transfer" algorithm, meaning if the connection drops, you can resume exactly where you left off.

Local to Remote (Upload)

# Syntax: rsync [flags] [source] [destination]
rsync -avzP ./local_folder user@remote_ip:~/remote_folder

Remote to Local (Download)

rsync -avzP user@remote_ip:~/remote_folder ./local_folder
Flag Breakdown:
  • -a (Archive): Preserves permissions, timestamps, and symlinks.
  • -v (Verbose): Shows you what is happening.
  • -z (Compress): Compresses data during transfer (crucial for slow networks).
  • -P (Partial/Progress): Shows a progress bar and allows resuming.

Scenario 3: Remote ↔ Remote (The "Tar Pipe")

This is where things get tricky. If you need to move a folder from Server A to Server B, and you are sitting on your laptop, you usually have two bad options:

  1. Download to your laptop, then upload to Server B (Double bandwidth usage).
  2. SSH into Server A and run rsync/scp to Server B (Requires setting up keys/agents on Server A).

There is a third, faster way: The SSH Tar Pipe.

By piping the stdout of one SSH command directly into the stdin of another, you stream the data directly between the two servers through your machine, but without writing a single byte to your local disk.

The Magic Command

# Transfer 'data_extraction_mcc' from Server A to Server B

ssh user@server_A_ip "tar -cvz -C ~/ data_extraction_mcc" | ssh user@server_B_ip "tar -xvz -C ~/"

Why is this the fastest?

  • No Intermediate Storage: Data flows as a stream. It is never saved to a temporary file on your laptop.
  • Compression: The -z flag compresses the stream before it hits the network and decompresses it only when it lands.
  • Single TCP Stream: Unlike scp -r, which negotiates a new handshake for every single file, tar creates one continuous stream. For directories with thousands of small files (like Python venv or node_modules), this is 10x-50x faster.

Command Breakdown

Sender Side (Server A)

tar -cvz -C ~/ folder_name

Creates (c) a compressed (z) archive. The -C ~/ ensures we change directory before archiving, so we don't send the full absolute path.

Receiver Side (Server B)

tar -xvz -C ~/

Extracts (x) the compressed (z) stream immediately into the home directory (-C ~/).

Summary

Stop using scp. It is a relic of a slower web.

  • Use rsync -avzP for daily uploads/downloads or syncing code.
  • Use SSH Tar Pipes for moving massive folders between remote servers quickly.