Linux write/append to remote file using ssh

To append content of a file in a remote server’s file use following command:

$ cat input.txt| ssh hostname 'cat >> output.txt'

To append some text in remote servers file use following command:

$ echo "Your text here" | ssh hostname 'cat >> output.txt'

Where input.txt is input file, hostname is remote Linux machine hostname or ip address, and output.txt is output file in remote machine.

-Sany

4 comments on “Linux write/append to remote file using ssh

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s