Linux - How to slow down the data flowing through a pipe

If for some reason you want to slow down the speed of a pipe between two process on Linux, you can use pv (pipe viewer).

For example you can use it this way to transfer a file to another place at a slow speed.

cat /home/user/file | pv -L 3k -q > /tmp/mynewfile

You can adjust the speed with the number given to the -L parameter to pv. For example 1, 10, 100, 1k, 10k, 1m etc.

The trick is to use -q, otherwise pv will behave as an interactive tool, displaying the progress bar and the transfer rate, which you don’t necessarily want.