Specifying a port for scp to use


This is a trick that gets me every time. To specify a port for ssh you need the argument -p but for scp it is -P. scp -p preserves the modification times of the files you are transferring. I’d love to know why they are different. I can only assume it’s because the need to preserve modification times came before the need to specify a port and they wouldn’t change backward compatibility.

Summary;

ssh -p
scp -P