Vi : Unable To Copy Text To Other File

Home » CentOS » Vi : Unable To Copy Text To Other File
CentOS 3 Comments

Hello All,

I’m trying to use vi commands instead of using the mouse.

I open Gnome-Terminal

I open a file : vi /home/jvermeulen/.ssh/id_dsa.pub

I select the key with ” V ” ( visual line )

I type ” y ” to yank the selected line.

I can now use
:e otherfile.txt and paste the text in otherfile.txt

This is the only way I succeed in copying text to another file in Gnome-Terminal of xterm.

But how can I copy text to a file on a remote machine?

Many thanks.

3 thoughts on - Vi : Unable To Copy Text To Other File

  • Hi, why would you use vi and not vim? Vim is better! : P
    if you can access the machine over SSH you can edit a file on the remote host using this special path when opening it:

    vim scp://username@host//path/to/file/on/remote/host/filename.extension

    or if you’ve already opened vim you can edit it by typing

    :edit scp://username@host//path/to/file/on/remote/host/filename.extension

    remember to write the file in order to save it, you do it by typing

    :w

    or

    :w filename

    Cheers

  • op 15-05-14 15:07, Lorenzo Andretta schreef:

    Hello Suomi en Lorenzo,

    thanks for the help.

    The syntax

    :editscp://username@host//path/to/file/on/remote/host/filename.extension

    is what I needed.

    Greetings, J.