Monday, 29 June 2009

Copying files on Linux using SSH

Well, I was familiar with using Secure CoPy ( SCP ) and have been using it extensively today to copy gigabytes of software products, including DB2 UDB, WebSphere Portal Express, Lotus Domino, Lotus Sametime and Lotus Connections.

However, I was struggling to know how to upload one file and have it append to another e.g. perform the equivalent of "cat foo >> bar" which appends the contents of foo onto bar.

Thanks to this most useful blog, I now know how - don't use SCP, use SSH instead: -

How to append remote file with local file over ssh connection

cat local-source-file-name | ssh user@some.domain "cat >> remote-target-file-name"

How to append to local file from remote file over ssh connection

ssh user@some.domain "cat remote-source-file-name" >> local-target-file-name

No comments:

Reminder - installing podman and skopeo on Ubuntu 22.04

This follows on from: - Lest I forget - how to install pip on Ubuntu I had reason to install podman  and skopeo  on an Ubuntu box: - lsb_rel...