Occasionally, I want to copy a short line of text to a remote computer. For instance, I have an URL for some real cool web site which, for whatever reason, I want to send to a remote host. I can always put the text in a file, and transfer it via scp.
$ cat > coolurl.txt http://really-cool-web-site/ $ scp coolurl.txt firstname.lastname@example.org:
Or, you can use the following one-liner command:
$ echo 'http://really-cool-web-site/'|ssh email@example.com 'cat >coolurl.txt'
The one-liner uses only simple commands such as echo, ssh and cat. It saves you the step of creating a new file on the local machine.
The text is saved to a file called coolurl.txt on the remote computer under your home directory.
Let me know your favourite way to accomplish the same thing.