summaryrefslogtreecommitdiff
path: root/ssh-tmux.1
blob: 590d9eb4b292242e2d793b6c8b0c29e7de9767ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
.\" 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 nohup 1 ,
.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.