Coincidentally, there was some discussion on the openssh-unix-dev list just a few days ago about the possibility of deprecating scp entirely (and/or introducing a CLI-compatible replacement using the sftp protocol internally): https://marc.info/?t=159232643300001&r=1&w=4
Great read! I use scp quite a lot. It sounds like I should learn sftp.
I’d really recommend rsync instead. As the article mentions, it’s essentially a drop-in replacement for scp and it’s much more performant in most use cases.
This. Also, while rsync can be used like a drop-in scp replacement, it can do a lot more than that and for copying or syncing whole trees or filesystems there’s nothing better. Just as ssh is the swiss-army knife of secure connections, rsync is the swiss-army knife of file tree copying / moving / duplicating. It’s well worth becoming thoroughly familiar with its command-line options.
rsync is a bit painful about when it copies files or directories and where exactly they will end up in what situations. I came to prefer https://github.com/DragonFlyBSD/cpdup because its UI is safe enough for me.
You only have to remember one basic Unix rule: foo is the directory itself and foo/ is the contents of the directory
Doesn’t rsync require a server, or at least rsync binary to be present on the remote machine?
No server required on remote, but yes you do need the binary on remote. I haven’t had any problems with it not being installed places I need, but you may have some different targets than I do. There are a couple of statically compiled copies of rsync you can drop in for different arches.
rsync can’t do what scp -3 does, can it?
Can’t say I’ve ever used -3. So without -3 it sounds like it tries to copy directly from one remote to another, but with -3 it’ll copy to the local machine and then pass the file through to the remote? If I understand correctly, then I believe you’re correct, rsync has no builtin capabilities for handling copying between two remotes. You’ll have to setup port forwards.
sftp behaves very similarly to ftp when it comes to commands, plus any recent releases come with tab completion for both local and remote files.
All you’ll probably ever need is put filename, get filename, put -r folder, get -r folder, ls, lls, cd, lcd. You can also run commands locally like “!vim filename”.
put -r folder
get -r folder
It’s very easy to get used to.
Tried it out today. Seems nice and easy to use