From 43c51a845c6fa159e41782301441f38241c349ed Mon Sep 17 00:00:00 2001 From: Stefan Kreutz Date: Mon, 23 May 2022 23:23:22 +0200 Subject: Describe interactive attach using choose-tree --- README.md | 12 +++++------- ssh-tmux.1 | 11 ++++++++--- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 0cd0938..1aba27a 100644 --- a/README.md +++ b/README.md @@ -8,17 +8,15 @@ with the ability to re-connect. ## Usage -The following command logs into the OpenSSH host `example.com`, creates and -attaches to a new Tmux session named `make`, and builds a project. +Build a project in a new Tmux session on a remote OpenSSH host: - $ ssh-tmux -s make example.com "cd project && make && sudo make install" + $ ssh-tmux example.com "cd project && make && sudo make install" -When you detach or disconnect, or simply want to watch from another client, you -can re-connect and re-attach as follows: +Connect and attach from another client or after disconnection: - $ ssh -t example.com tmux attach-session -t make + $ ssh -t example.com "tmux attach-session \; choose-tree" -See the manual page for more examples. +See the manual page for details and more examples. ## Installation diff --git a/ssh-tmux.1 b/ssh-tmux.1 index 590d9eb..40863b0 100644 --- a/ssh-tmux.1 +++ b/ssh-tmux.1 @@ -63,12 +63,12 @@ Execute a possibly long-running interactive remote command: $ ssh-tmux example.com "cd project && make && doas make install" .Ed .Pp -A command with local and remote shell expansion: +Connect and attach from another client or after disconnection: .Bd -literal -offset indent -$ ssh-tmux example.com echo $HOST \e$HOST +$ ssh -t example.com "tmux attach-session \e; choose-tree" .Ed .Pp -Detach and re-attach session: +Detach and re-attach a named session: .Bd -literal -offset indent $ ssh-tmux -d -s monitor example.com top $ ssh -t example.com tmux attach-session -t monitor @@ -79,6 +79,11 @@ Move window to another session: $ ssh-tmux -d -s monitor -n top example.com top $ ssh -t example.com "tmux new-session -A -s mysession \e; move-window -s monitor:top" .Ed +.Pp +A command with local and remote shell expansion: +.Bd -literal -offset indent +$ ssh-tmux example.com echo $HOST \e$HOST +.Ed .Sh SEE ALSO .Xr nohup 1 , .Xr ssh 1 , -- cgit v1.2.3