How To Append File Using SSH
By Angsuman Chakraborty, Gaea News NetworkSunday, October 12, 2008
Have you ever searched scp manual for ways to append a file using it? scp is an excellent command to rapidly copy files and directories to / from a remote location. Unfortunately it is of no help when you just want to append a file over ssh connection. Here is a simple solution to append a file over ssh connection in either direction:
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
Tags: Linux, scp
October 14, 2008: 6:54 am
Angsuman, when using IE 7(NOW), I see that my comments are appended with anotice that they are being on WAIT for moderation. But I didn’t see my comment post at all on firefox. BR, |
October 14, 2008: 6:52 am
hi angsuman, thanks for replies. Happy dusshera. I tried this on firefox 3.x on windows XP. I pressed submit but my comment appears to have disappeard so trying again on IE 7 on windows XP. append to local file from remote : Actually, what I’m trying to do is tail multiple logs (on solaris) on my windows XP box. I guess that I need rsync since what I really want to do is look at updated log entries. But the problem is sysadmins don’t always let rsync traffic BUT always let ssh in. Do you have an example of rsync over ssh ? Thank you, BR, |
October 14, 2008: 6:50 am
hi angsuman, thanks for replies. Happy dusshera. I’m trying this on firefox 3.x on windows XP. append to local file from remote : Actually, what I’m trying to do is tail multiple logs (on solaris) on my windows XP box. I guess that I need rsync since what I really want to do is look at updated log entries. But the problem is sysadmins don’t always let rsync traffic BUT always let ssh in. Do you have an example of rsync over ssh ? Thank you, BR, |
October 12, 2008: 7:50 pm
> How about if I want to pull something from the server. I updated the post with an example for that too. Take care, |
October 12, 2008: 7:37 pm
@Anjan Thanks for letting me know. BTW: Can you please try to comment again using Firefox. I think it will work now as we have fixed an issue. |
October 12, 2008: 12:12 pm
BTW, It is impossible to leave comments on your blog using Firefox 3.x. I’ve tried, in vain, for several months, to leave comments. Finally, i decided that I had to leave comments and finally switched to chrome and that worked. BTW, I noticed that the browser had auto-filled the previous commentor “Kostikes” with his name, email and website. Thanks for fixing these issues. BR, |
October 12, 2008: 12:10 pm
hi angsuman, thanks for the tip. the command you have given will be able to append the target file on the server running ssh. How about if I want to pull something from the server. Let’s say, I want to append log files from a linux/unix server to my windows box. How would I do that ? Thank you, BR, |
anjan bacchu