Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you edit files over SSH?

I program with eclipse and sometimes use GUI text editors like SciTE or vim. However, I'm at a point in a project that requires me to edit files over a ssh connection in a 80 column SSH window.

Since I have to (* shiver*) sudo vim before I can open the file I'm not sure how to open the file in an editor outside the terminal (that would allow me to see the text wider than 80 columns). If the command line was larger then I guess using straight vim wouldn't be a problem.

I'm at a loss of how to deal with this situation and how I could turn this nightmare into a manageable coding environment.

like image 715
Xeoncross Avatar asked Aug 04 '10 15:08

Xeoncross


People also ask

How do I edit a file in Terminal?

If you want to edit a file using terminal, press i to go into insert mode. Edit your file and press ESC and then :w to save changes and :q to quit.


1 Answers

Maybe you should simply mount the remote filesystem to your local machine and then use whatever editor you like. If running a Debian derivative, install sshfs

sudo apt-get install sshfs 

and then mount the remote filesystem ( issue on your local machine )

mkdir ~/remote_code sshfs [email protected]:/home/$USER/code ~/remote_code 

Once this is done you can access the code in ~/remote_code w/ any of your GUI tools and without the bandwidth overhead of using ssh -X (however you still need a good connection w/ a low ping time).

PS: When using ssh I can make the terminal as wide as it fits my screen and then use its full width, so I fear I don't completely understand your issue.

like image 173
Gerald Senarclens de Grancy Avatar answered Sep 18 '22 20:09

Gerald Senarclens de Grancy