xref: /freebsd/usr.sbin/watch/watch.8 (revision ae83180158c4c937f170e31eff311b18c0286a93)
1.\"
2.\" $FreeBSD$
3.\"
4.Dd November 24, 2001
5.Dt WATCH 8
6.Os
7.Sh NAME
8.Nm watch
9.Nd snoop on another tty line
10.Sh SYNOPSIS
11.Nm
12.Op Fl cinotW
13.Op Fl f Ar snpdev
14.Op Ar tty
15.Sh DESCRIPTION
16The
17.Nm
18utility allows the user to examine all data coming through a specified tty
19using the
20.Xr snp 4
21device.
22If the
23.Xr snp 4
24device is not available,
25.Nm
26will attempt to load the module
27.Pq Nm snp .
28The
29.Nm
30utility writes to standard output.
31.Pp
32The options are as follows:
33.Bl -tag -width indent
34.It Fl c
35Reconnect on close.  If the tty observed by
36.Nm
37is closed,  automatically reattach to the same tty.
38If this option is not specified,
39.Nm
40will request a new tty if running in interactive mode or exit if running
41without a controlling tty.
42.It Fl f Ar snpdev
43If this option is specified,
44.Nm
45will use
46.Ar snpdev
47as the
48.Xr snp 4
49device.
50Without this option,
51.Nm
52will attempt to find the next available
53.Xr snp 4
54device.
55.It Fl i
56Force interactive mode.
57Interactive mode is a default if
58.Nm
59is started from a tty.
60If output is redirected to a file, interactive mode can still be requested
61by specifying this option.
62.It Fl n
63Disable the ability to switch the watched tty interactively.  This disables
64both change requests made with <control-X> as well as automatic prompting
65when the current tty is closed or overflows.  In all cases where a prompt
66would be displayed,
67.Nm
68will exit.  The reconnect flags are unaffected by
69this option.
70When this flag is used, <control-X> is passed through to the terminal.
71.It Fl o
72Reconnect on overflow.
73The behavior of
74.Nm
75if the observed tty overflows is similar to the behavior if the observed tty
76is closed.
77For more info see
78.Xr snp 4 .
79.It Fl t
80Print the date and time when observation of a given tty is started.
81.It Fl W
82Allow write access to observed tty.
83.It Ar tty
84Tty may be specified as an tty-style device, such as a pseudo tty device,
85a virtual console, or a serial line, etc.
86Names may be preceded by
87.Pa /dev/ .
88.El
89.Sh OPERATION
90While running in interactive mode, all user input is discarded except for:
91.Pp
92.Bl -tag -width "XXXX" -compact
93.It Sy "<control-G>"
94Exit
95.Nm .
96.It Sy "<control-W>"
97Clear screen.
98.It Sy "<control-X>"
99Change attached tty, unless this feature is disabled, in which case
100control-X is passed to the terminal as with other control characters.
101.El
102.Sh SEE ALSO
103.Xr pty 4 ,
104.Xr sio 4 ,
105.Xr snp 4 ,
106.Xr kldload 8
107.Sh BUGS
108No terminal emulation is performed.
109All user output is reproduced as-is.
110.Sh AUTHORS
111.An Ugen J.S. Antsilevich Aq ugen@NetVision.net.il
112.Sh HISTORY
113The
114.Nm
115utility first appeared in
116.Fx 2.1 .
117