Question

Is there any way to use an instance of vi/vim on a remote server to edit a local file?

Something along the lines of:

cat $local_file | ssh -t $remote_server "vim -" > $local_file

[I'm using the code above only to simplify and illustrate the intent of the question]

I know that I can go the other way and edit the file from the remote_server using vim + scp, but I was curious if it could be done in this direction as well.

Was it helpful?

Solution

You can use this kind of command :

ssh -t remote 'vim scp://root@oldy//etc/resolv.conf'

vim copy the file in local /tmp in a file like /tmp/v7MZ6yF/0 in the background.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top