Skip to content

Sync Across Two Systems

Jackson Huff edited this page Apr 19, 2023 · 2 revisions

Intro

Many Clipboard Project users have asked how to sync the clipboard across two systems. As it turns out, there is a simple way to do it (in theory).

How To Do It

You'll need to install the sshfs utility. sshfs mounts a folder on a remote system anywhere onto yours, over the network, all using SSH. Because CB stores all of its data in a specific folder, you can mount this specific folder onto a different system and have the CB tool access it as if it were on the local one.

1. Get sshfs by any suitable method.

2. Mount the temporary CB folder using sshfs.

Note that this folder is system-specific and may not be the same everywhere. However, on many Linux systems, this folder is /tmp/Clipboard. For the permanent CB folder, this is even more system-specific because it depends on the user using CB. However, on Linux it should follow the format /home/USER-HERE/.clipboard.

When mounting the folder(s), make sure you mount them in the same spot as CB would access it on your local system. If the two systems are running the same OS, this is likely the same folder as found above. For example, if CB accesses /tmp/Clipboard on the remote system and /foobar/blah/Clipboard on yours, mount /tmp/Clipboard to /foobar/blah/Clipboard.

3. Go Nuts!

You should be done at this point. Now you can cut, copy, and paste wherever!

Warning! Due to inherent limitations with GUI clipboards, whatever you transfer over to the other system may be overwritten by what is in the native GUI clipboard there. To avoid this, choose any clipboard other than the default (with name "0"). For example, to copy a file, use cb cp1 your-file instead of cp cp your-file. This example uses clipboard 1 instead of 0.