I'm fiddling with scp on mac and it seems to me like the -l option doesn't work; though I'm also (perhaps more) open to the idea that I'm just misunderstanding or misusing something. I'm not trying to solve a problem that requires limiting the bandwidth of a transfer so I don't need alternative suggestions, I'm just curious what's going on with my attempt to use this specific option. Looking for dis/confirmation that this is the behaviour other's are seeing and/or an explanation of what's wrong with my attempt.

I made a 10K file then tried to scp it to localhost:<file> with a limit of 1Kb/s thinking it should take ~80 seconds but the output of scp shows a transfer speed higher than 1Kb/s and the command completes effectively immediately.

man scp output for -l option

xy@xyz exploring-scp % man scp | grep -B1 Limits
    -l limit. 
        Limits the used bandwidth, specified in Kbit/s.

sh commands I used

cat /dev/random | head -c 10240 > $src                  
scp -i ~/.ssh/id_rsa -l 1 $src localhost:/tmp/random.bin

My first thought was that maybe it's being "smart" and seeing localhost and skipping the network and therefore skipping with bandwidth limit; but the same thing happens both if I use the explicit IP for localhost, and also if I try to scp the file from a docker container back to the mac host.

I'm also fairly confident I've used the -l flag successfully on linux even when copying to/from localhost. (I was fiddling with it a little while ago on linux but it's not convenient right now for me to access a linux machine to try it on).

MacBook Pro (Retina, 13-inch, Early 2015)
2.7 GHz Dual-Core Intel Core i5
8 GB 1867 MHz DDR3
Intel Iris Graphics 6100 1536 MB


1 Answer 1


The scp man page is pretty bare bones, but wget and rsync both provide this capability and are a bit more verbose on the subject.

man wget will tell you:

Note that Wget implements the limiting by sleeping the appropriate amount of time after a network read that took less time than specified by the rate. Eventually this strategy causes the TCP transfer to slow down to approximately the specified rate. However, it may take some time for this balance to be achieved, so don't be surprised if limiting the rate doesn't work well with very small files.

man rsync says:

Rsync writes data over the socket in blocks, and this option both limits the size of the blocks that rsync writes, and tries to keep the average transfer rate at the requested limit. Some burstiness may be seen where rsync writes out a block of data and then sleeps to bring the average rate into compliance.

I can't say for sure that either of these are the case with scp's internals but I have had success applying rate limits to particularly large files.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .