blog // ~snubspreker

this is just a test

The Editor and the Tramp

April 14, 2020 — ~snubspreker

The Editor and the Tramp

You have most likely logged into the tilde.team server with something like:

yourusername@tilde.team

You may be editing files, posting to a blog with bb or something like that, but you don't need to log in just to edit files. Emacs has a builtin feature called tramp that allows you to create and edit files on a remote server using (rlogin, telnet, or ssh)

TRAMP (Transparent Remote Access, Multiple Protocols) is a package for editing remote files, similar to AngeFtp or efs. Whereas the others use FTP to connect to the remote host and to transfer the files, TRAMP uses a remote shell connection (rlogin, telnet, ssh). It can transfer the files using rcp or a similar program, or it can encode the file contents (using uuencode or base64) and transfer them right through the shell connection.

EmacsWiki: Tramp Mode

The how

How is pretty simple. Normally in emacs, to open or create a file you would press C-x C-f then enter the path and file name when prompted. Say I have a file on my local system called:

~/public_html/test.html

I would enter that path and press enter when prompted. But to edit the same file on a remote system, you would type:

ssh:yourusername@tilde.team

then press enter. You'll be prompted for a password and then presented with a list of files on the remote system to which you have access.

Emacs now treats this new, remote file system just like your local file system. You can basically forget that you are logged into this remote system and just do the work you set out to do.

Using emacs in the terminal on tilde.team is great, but if you like emacs and want to use it on your own system with your own personalizations, and cut down on the steps required to do the stuff you want, this is a great way to have your cake and emacs it too.