Limit SCP Transfer Bandwidth on Ubuntu Linux
This article provides a quick and straightforward guide on how to restrict the network bandwidth used during an SCP (Secure Copy Protocol) file transfer on Ubuntu Linux. You will learn about the specific command-line parameter used to throttle transfer speeds, how to calculate the limit value, and practical command examples to help you manage your network resources efficiently.
The -l Parameter
The standard way to limit bandwidth during an SCP transfer is by
using the -l (limit) option. This parameter restricts the
maximum transfer speed to a specified rate.
It is important to note that the value for the -l
parameter must be specified in kilobits per second
(kbps), not kilobytes per second (KB/s). Because 1 byte
consists of 8 bits, you must multiply your desired limit in kilobytes by
8 to get the correct value for the command.
For example: * To limit the transfer speed to 50 KB/s, multiply 50 by 8 to get 400. * To limit the transfer speed to 1 MB/s (1024 KB/s), multiply 1024 by 8 to get 8192.
Command Examples
To apply the limit, insert the -l flag followed by the
calculated numeric value immediately after the scp
command.
Uploading a File with a Limit
To upload a local file to a remote server while limiting the upload speed to 100 KB/s (800 kbps), use the following command:
scp -l 800 localfile.tar.gz user@remote_host:/destination/path/Downloading a File with a Limit
To download a file from a remote server to your local machine while limiting the download speed to 500 KB/s (4000 kbps), run:
scp -l 4000 user@remote_host:/remote/path/file.zip /local/destination/By utilizing the -l flag, you can easily prevent SCP
transfers from consuming your entire network connection, ensuring other
critical services on your Ubuntu system remain responsive.