A simple trick I came up with it to call my text editor by SSH using path translation. Of course, you will need to translate the paths and otherwise adapt it to your needs, but this should get you started:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Starting Sublime Text from inside a Virtual Machine | |
# @link https://gist.github.com/lavoiesl/c01b16b5f875906a6d82 | |
# You may require to install realpath | |
path="$(realpath "$1")" | |
if echo "${path}" | grep -q "^/media/data/projects"; then | |
path="$(echo "${path}" | sed 's/^\/media\/data\/projects\//~\/projects\//')" | |
elif echo "${path}" | grep -q "^/media/home"; then | |
path="$(echo "${path}" | sed 's/^\/media\/home\//~\//')" | |
else | |
echo "Only paths inside /media/data/projects and /media/home are supported" >&2 | |
exit 1 | |
fi | |
ssh seb@10.10.10.1 subl "${path}" |
Make sure you have ~/.ssh/authorized_keys and ForwardAgent properly setup to avoid password prompts each time.
You could also use this trick to open a webpage by using the “open” program on Mac. Equivalent exists on most Linux distros.