Skip to main content

How to copy file contents to the local clipboard from a file in a remote machine over ssh [Resolved]

To solve this problem I always have to use scp or rsync to copy the file into my local computer to open the file and simply copy the contents of the text file into my local clipboard. I was just wondering if there is a more clever way to do this without having the need of copying the file.


Question Credit: VaTo
Question Reference
Asked September 10, 2019
Tags: , clipboard
Posted Under: Unix Linux
21 views
3 Answers

Can I assume you are running the X Window System and some window manager (KDE/gnome/etc.)? There are a number of terminal applications (Konsole for example) that have a built in menu that allows copy/paste functions. So you could:

  1. user@machine:~$ ssh root@172.x.x.x
  2. open the file on the remote machine
  3. highlight the contents of the file with mouse and select copy from the edit menu on your local machine.

Or did I misunderstand your real needs?


credit: Anthon
Answered September 10, 2019

Using Putty as your SSH client, ensure you max out lines of scrollback in your configuration. When you connect, you can clear screen and scrollback and then cat the file and when I right click on the title bar, I can select "copy all to clipboard". Then I can paste into an editor on my local machine.


credit: Mike Pone
Answered September 10, 2019
Your Answer
D:\Adnan\Candoerz\CandoProject\vQA