Linux Remote File Editing

(Keep in mind this plugin is only available for Sublime Text but there may be other implementations for other editors that I’m not aware of.

)The setup is rather trivial as long as you can install the server piece on your remote server.

Install ruby on your server: sudo apt-get install rubythen it’s as simple as: gem install rmate gem update rmateOtherwise here’s a curl command to get what you need (may require superuser powers): curl -Lo ~/bin/rmate https://raw.

githubusercontent.

com/textmate/rmate/master/bin/rmateAnd then fix permissions and add to PATH: chmod a+x ~/bin/rmate export PATH="$PATH:$HOME/bin"So close!!Next you’ll need to install the RSub package in Sublime Text, which requires Package Control in Sublime Text.

If you’re a regular user of Sublime, you likely already have this.

If not, the installation is simple.

In Package Control, search for the rsub package and install it.

RSub only listens locally by default for security reasons so you’ll need to add this to your ~/.

ssh/config file (make sure to replace “example.

com” with your host): Host example.

com RemoteForward 52698 127.

0.

0.

1:52698Now is the moment of truth! On your remote server, run the rmate command with your file you want to edit: rmate blah.

txtAND JUST LIKE THAT, Sublime should open on your screen with the remote file displayed 🙂 Edit as desired and save after every keystroke if you want to.

We did it.

The nice thing about this method is that we’re editing a text file via ssh, which if you’re ssh’ing into a remote server, it has the same overhead as this method.

The obvious benefit, and purpose of this article, is that now you have access to edit using a GUI tool instead of a terminal text editor.

This can mean more flexibility, more plugins that can help your workflow, and more using the mouse (gross actually, but Sublime has some excellent keyboard shortcuts too!).

Let’s show Henrik some love for this awesome plugin!UltimatelyIf you know vim or emacs and enjoy that experience, it’s definitely your best bet.

Now for the rest of us plebs, we have some really cool options that we didn’t have previously.

So maybe next time I’m asked what my preferred linux command line text editor is I’ll at least have a better answer than nano and can show that I’ve got some skill in getting a modern editor up and running for remote connections ;).

. More details

Leave a Reply