How to resume a partially transferred file over ssh on Linux?

File transfer interruptions are common when copying large files over SSH connections. Network instability, connection timeouts, or accidental process termination can cause transfers to fail partway through. While the scp command doesn't support resuming interrupted transfers, Linux provides rsync as a powerful alternative that can resume partially transferred files.

The scp command forces you to restart the entire transfer from the beginning, overwriting any partially transferred data. This becomes extremely frustrating and time-consuming when dealing with large files or unreliable network connections.

What is Rsync?

Rsync (Remote Sync) is a versatile command-line utility for synchronizing files and directories between local and remote systems. It uses a delta-transfer algorithm that only sends the differences between source and destination files, making it highly efficient for resuming interrupted transfers.

Key Features

  • Resume capability − Can continue interrupted file transfers

  • Delta synchronization − Only transfers changed portions of files

  • Progress monitoring − Shows real-time transfer progress

  • Bandwidth optimization − Reduces network usage through compression

Installation

Install rsync using your distribution's package manager:

Ubuntu/Debian

sudo apt-get install rsync

Fedora/CentOS

sudo dnf install rsync

Example − Resuming an Interrupted Transfer

Let's demonstrate how to resume a partially transferred file using rsync.

Initial Transfer (Using SCP)

Start copying a large file using the standard scp command:

scp goAgent.tar.gz immukul@192.168.110.11:/home/Documents/

If the transfer gets interrupted (network issue, Ctrl+C, etc.), you'll see output like:

goAgent.tar.gz                    51%  399MB  26.2MB/s   00:39 ETA^C

At this point, the file is only 51% transferred on the remote system.

Resume Transfer (Using Rsync)

Use rsync with the -P flag to resume the interrupted transfer:

rsync -P -rsh=ssh goAgent.tar.gz immukul@192.168.110.11:/home/Documents/

Rsync will detect the partially transferred file and resume from where it left off:

goAgent.tar.gz              100%  840.00M  26.2MB/s   0:00:43

Important Rsync Options

Option Description
-P Shows progress and enables partial transfer resume
-r Recursive copy for directories
-ssh Uses SSH as the remote shell
-z Enables compression during transfer
-v Verbose output for detailed information

Best Practices

  • Use rsync for large files − Always prefer rsync over scp for files larger than 100MB

  • Enable compression − Add -z flag for slow network connections

  • Monitor progress − The -P flag provides valuable transfer statistics

  • Test connectivity − Ensure SSH access works before starting large transfers

Conclusion

Rsync is the preferred solution for resuming interrupted SSH file transfers on Linux. Its delta-transfer algorithm and built-in resume capability make it far superior to scp for large file transfers. Always use rsync with the -P option when transferring files that might be interrupted.

Updated on: 2026-03-17T09:01:38+05:30

982 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements