A web page provides web-based ssh access to a linux machine. I'm using it one a Windows7 machine.

While editing a file in vi, I want to repeadetly enter the following:


This (1) goes to the next line, then (2) goes to the beginning of the line, then (3) goes to the next occurrence of the search term, then (4) moves one space to the left, then (5) deletes everything on the line to the left of that point. The "0" is just because I'm being really cautious.

I thought what I'd do is write the following


and then copy that and paste it (while not in insert mode, of course) and it would do that operation on 15 lines, and then I could stare at it for a few seconds to make sure it didn't do anything wrong, before doing it the next time. Doing this a couple of hundred times would finish the job in minutes.

But the interface won't let me copy and paste.


  • Is there some way I can copy and paste?
  • Should I do something intelligent instead? If so, what?
  • It sounds like something you could accomplish with a search-and-replace command à la :%s/regex/something else/ but it's not clear just from j0nhd what it is you're actually doing. By the way, you're missing something from the end of that, for example a $, because d takes an argument.
    – Celada
    Jun 15 '15 at 0:14
  • But in any case, why not use a native SSH client. That will surely not have a copy&paste problem.
    – Celada
    Jun 15 '15 at 0:14
  • @Celada : typo: I meant j0nhd0 Jun 15 '15 at 0:18
  • d0 deletes everything on the line to the left of where the editing cursor is. Jun 15 '15 at 0:19
  • @Celada : Does that sufficiently clarify what I'm doing? Jun 15 '15 at 0:24

Due to how the browser DOM security model works, this kind of web interface cannot easily access the system clipoboard (or else random web pages could steal the clipboard content).

Your problem is not related to SSH or vi and the intelligent choice would be to use a native SSH client (e.g. Putty).

  • I have now downloaded PuTTY and used it to log in to the remote unix machine, and done some editing on the file in question, so all of that works. But I am still not able to copy and paste. When I try to paste this message appears at the bottom of the screen: VISUAL BLOCK. Jun 15 '15 at 3:46
  • This either means that you pasted an escape character or that you pasted while in command mode. Jun 15 '15 at 4:54
  • Do you mean as opposed to insert mode? Clearly the thing I was pasting was not something I wanted to insert. Jun 15 '15 at 5:14
  • OK, I've got copy-and-paste working in PuTTY now. It turns out I needed to use the right mouse button rather than the middle one. Jun 15 '15 at 22:48

Hey if you use the chrome browser you can install the Secure Shell add on/app its quite simple to SSH over LAN or WAN. And it provides the functionality you are looking for.

Simply copy from a different source and doubletap in the console to paste or if you want to copy from the console highlight the text and it automatically copies the selected text.

If you face problems with connecting somewhere down the line (can happen when you use the same IP for different computers. Try removing allknownhosts from java using CTRL+ALT+J. To be more specific: term_.command.removeAllKnownHosts()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.