SCP suffered from weak input validation for decades until CVE-2019-6111 , the maintainers recommended using SFTP until patched versions can be deployed. I, like many others, were reminded SFTP existed!

In brief, SFTP is the tried & true FTP wrapped in SSH; SCP is a very dated RCP inside SSH. As this CVE shows, the SCP codebase has been neglected and perhaps shouldn’t be relied on.

Send file to remote:

sftp user@host:/path/to/put.file <<< "put /path/to/local.file"

Receive file from remote:

sftp user@host:/path/to/remote.file /path/to/local.file

Add -r to recurse a directory.

It’s less trivial than SCP, although SFTP has more features, like interactive mode:

$ sftp user@host
Connected to host.
sftp> ls
sftp> cd test
sftp> ls
sftp> get
Fetching /home/me/test/ to
/home/me/test/           100%  196   193.7KB/s   00:00
sftp> exit
$ ls