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