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:

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...