Skip to content
Zync
All posts
Guide5 min read

Using tmux over SSH with Zync

A beginner’s guide to starting a tmux session over SSH, splitting panes, switching focus and reconnecting, with Zync’s terminal shortcut settings explained.

In this article

You are working over SSH and want to leave a command running while you disconnect. Or you want a few shells inside the same remote session, so you can watch output in one and run commands in another.

tmux helps with both. It runs on the server, keeps terminal sessions there, and lets you detach and return later. Zync provides the desktop terminal and SSH connection you use to reach it.

This guide starts with one disposable session. You do not need a custom tmux configuration or previous tmux experience.

Before you start

You need Zync, an SSH connection to a Linux or Unix-like server, and tmux installed on that server. Run this in the remote shell:

Terminal window
tmux -V

It should print a version. If the command is missing, install tmux using the server’s package manager, if you are authorized to do so. For example, on Debian or Ubuntu:

Terminal window
sudo apt update
sudo apt install tmux

Installing tmux on your laptop does not install it on the remote server. For local practice on Windows, use a WSL shell with tmux installed inside that distribution.

The examples below assume tmux’s default prefix and bindings. An existing ~/.tmux.conf may change them. Use a shell that is not already inside tmux for this first exercise.

1. Give tmux its prefix key

In Zync’s profile menu, open Keyboard shortcuts and select Terminal first. This is a global preference, so it applies to all terminals.

Terminal first lets ordinary terminal keys reach the focused shell, while selected Zync shortcuts can still remain available. Open View & edit shortcuts… in the same menu to inspect or change those choices.

tmux’s default prefix is Ctrl+B, including when Zync runs on macOS. If that key opens a Zync panel instead, check for a custom binding marked Available in terminal and unreserve or remap it. Click inside the terminal before testing again.

When this guide says “Ctrl+B, then D,” press Ctrl and B together, release them, then press D. You are sending two successive keypresses, not holding all three keys together.

2. Create a named session

Run this on the server:

Terminal window
tmux new-session -s zync-demo

You should see tmux’s status line at the bottom. You are now inside a session named zync-demo.

Run a harmless command to make this shell recognizable:

Terminal window
printf 'This is the first tmux pane\n'

If tmux reports a duplicate session name, list the existing sessions with tmux list-sessions. Attach to your earlier practice session with tmux attach-session -t zync-demo, or choose a different name when creating a new one.

3. Split the remote window

Press Ctrl+B, then %. tmux creates two panes side by side.

In the new pane, run:

Terminal window
printf 'This is the second tmux pane\n'

Press Ctrl+B, then Left Arrow to focus the pane on the left. Use Ctrl+B, then Right Arrow to return to the right. You can also press Ctrl+B, then O to cycle through panes.

For a top-and-bottom split, use Ctrl+B, then “. Press the key that produces the double-quote character on your keyboard.

These panes belong to tmux on the remote server. Zync’s own split controls create separate workspace panes. Both can be useful, but for this exercise, use the tmux keys so all the shells stay in the named remote session.

4. Detach and return

In one tmux pane, run:

Terminal window
sleep 300

The command waits for five minutes without producing output. While it is running, press Ctrl+B, then D. You should return to the remote shell outside tmux, while the session continues on the server.

List it:

Terminal window
tmux list-sessions

Then return:

Terminal window
tmux attach-session -t zync-demo

Your panes should still be there. If five minutes have already passed, sleep will have finished and its shell prompt will be back. Otherwise, focus that pane and press Ctrl+C to interrupt the practice command.

To test reconnecting, detach first, disconnect the SSH connection, reconnect to the same server as the same user, and run the attach command again. A network interruption normally leaves tmux running too, provided the server’s tmux process stays alive.

tmux does not preserve running processes through a server reboot or a killed tmux server. System policies that terminate user processes on logout can also affect it. It is useful for interactive work; it does not replace a service manager for production services.

tmux has its own pane history and copy buffers. Press Ctrl+B, then [ to enter copy mode. With the default Emacs-style copy bindings, use the arrow keys or Page Up to move through history, and press Q to leave. Vi-style bindings or custom configuration can differ.

Copying inside tmux does not automatically mean the text reached your desktop clipboard over SSH. That requires compatible clipboard configuration. The upstream tmux clipboard guide explains the available approaches.

For a simple first exercise, leave tmux mouse mode off and try selecting visible text with Zync’s terminal selection. Use the terminal’s Copy action or your configured copy shortcut. When you enable mouse mode, tmux receives mouse input for pane selection, resizing and its own text selection. You can toggle it from a shell inside tmux:

Terminal window
tmux set-option -g mouse on

To turn it off again:

Terminal window
tmux set-option -g mouse off

The -g option changes the global setting on that tmux server, potentially affecting other sessions. You do not need mouse mode for the steps above.

Zync’s Find in terminal button opens its terminal search independently of shortcut priority. It searches Zync’s available terminal buffer; tmux’s per-pane history is separate. Use tmux copy mode when you need to navigate that history. Ctrl+F may remain a shell key in Terminal first mode unless you explicitly reserve it for Zync.

If something behaves differently

  • Ctrl+B opens Zync: confirm Terminal first, terminal focus and your current shortcut reservations.
  • “Can’t find window”: a numeric shortcut selects a tmux window, not a pane. Use the arrow bindings above or Ctrl+B, then O for pane switching.
  • “No sessions”: check the server, SSH user and session name. The previous session may have ended or the server may have restarted.
  • Tab completion changes inside tmux: completion comes from the shell running in that pane. Zync’s inline suggestions are suppressed in alternate-screen and mouse-reporting contexts; they are separate from shell Tab completion.

Finish the practice session

In each practice pane, stop the demo command if needed, then run exit. With a normal default configuration, a pane closes when its shell exits; the session ends after its last window closes. Detaching with Ctrl+B, then D leaves it running instead.

For the complete command reference, see the upstream tmux getting-started guide. If a key still fails in Zync, report your OS, Zync version, tmux version, shortcut mode and the exact key sequence through Settings > Feedback or GitHub issues.

Put it into practice.

Open a local shell. Connect to your server. Make the workspace yours.

Get Zync