1. 40
  1. 12

    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

    1. 6

      Great read! I use scp quite a lot. It sounds like I should learn sftp.

      1. 15

        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.

        1. 8

          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.

          1. 5

            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.

            1. 3

              You only have to remember one basic Unix rule: foo is the directory itself and foo/ is the contents of the directory

          2. 2

            Doesn’t rsync require a server, or at least rsync binary to be present on the remote machine?

            1. 2

              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.

            2. 1

              rsync can’t do what scp -3 does, can it?

              1. 1

                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.

            3. 7

              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”.

              It’s very easy to get used to.

              1. 2

                Tried it out today. Seems nice and easy to use