summaryrefslogtreecommitdiff
path: root/ssh-tmux.1
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-tmux.1')
-rw-r--r--ssh-tmux.186
1 files changed, 86 insertions, 0 deletions
diff --git a/ssh-tmux.1 b/ssh-tmux.1
new file mode 100644
index 0000000..ec62371
--- /dev/null
+++ b/ssh-tmux.1
@@ -0,0 +1,86 @@
+.\" Copyright (c) 2022 Stefan Kreutz <mail@skreutz.com>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.Dd $Mdocdate: May 18 2022 $
+.Dt SSH-TMUX 1
+.Os
+.Sh NAME
+.Nm ssh-tmux
+.Nd execute commands in remote tmux sessions
+.Sh SYNOPSIS
+.Nm ssh-tmux
+.Op Fl d
+.Op Fl s Ar session
+.Op Fl n Ar window
+.Ar host
+.Ar command
+.Op Ar argument ...
+.Sh DESCRIPTION
+The
+.Nm
+utility executes the given
+.Ar command
+via
+.Xr ssh 1
+in a new
+.Xr tmux 1
+session on the specified
+.Ar host .
+The
+.Ar command
+may have additional arguments.
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl d
+Detach from the
+.Xr tmux 1
+session.
+.It Fl s Ar session
+The name of the
+.Xr tmux 1
+session.
+.It Fl n Ar window
+The name of the
+.Xr tmux 1
+window.
+.El
+.Sh EXIT STATUS
+.Ex -std ssh-tmux
+.Sh EXAMPLES
+Execute a possibly long-running interactive remote command:
+.Bd -literal -offset indent
+$ ssh-tmux example.com "cd project && make && doas make install"
+.Ed
+.Pp
+A command with local and remote shell expansion:
+.Bd -literal -offset indent
+$ ssh-tmux example.com echo $HOST \e$HOST
+.Ed
+.Pp
+Detach and re-attach session:
+.Bd -literal -offset indent
+$ ssh-tmux -d -s monitor example.com top
+$ ssh -t example.com tmux attach-session -t monitor
+.Ed
+.Pp
+Move window to another session:
+.Bd -literal -offset indent
+$ 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
+.Sh SEE ALSO
+.Xr ssh 1 ,
+.Xr tmux 1
+.Sh AUTHORS
+.An Stefan Kreutz Aq Mt mail@skreutz.com
Generated by cgit. See skreutz.com for my tech blog and contact information.