3 ms·
I mostly use ssh and tar instead of scp, because I'm usually after more than one file. Like, "ssh remote 'cd /whatever; tar -cf - someglobpattern' | tar -xvf"
by tyingq 7y ago
I mostly use ssh and tar instead of scp, because I'm usually after more than one file.
Like, "ssh remote 'cd /whatever; tar -cf - someglobpattern' | tar -xvf"
- emmelaich 7y agoTip: get into the habit of using && rather than ; So... > ssh remote 'cd /whatever && tar -cf - someglobpattern' | tar -xvf
- gdavisson 7y agoSeconded. Here https://apple.stackexchange.com/questions/378942/cant-initialize-osx-interrogation-folder https://apple.stackexchange.com/questions/378942/cant-initia... is an example of what can happen from not checking for errors after a `cd` command. Summary: "sudo find ... -delete" ran in the root directory rather than the intended location, and now the OS is gone (probably along with lots more).
- tyingq 7y agoFair observation. I will change my ways :)
- nine_k 7y agoCould also be faster because of the common compression dictionary.
- heinrichhartman 7y agoeven better printf "<cmd>" | ssh bash or cat cmd.sh | ssh bash This passes all of stdin to the remote bash, avoiding any expansions happening on the local side entirely.