]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man4/pts.4
Many pages: Use correct letter case in page titles (TH)
[thirdparty/man-pages.git] / man4 / pts.4
CommitLineData
fea681da
MK
1.\" This man page was written by Jeremy Phelps <jphelps@notreached.net>.
2.\" Notes added - aeb
2297bf0e 3.\"
73624cb2 4.\" %%%LICENSE_START(FREELY_REDISTRIBUTABLE)
fea681da 5.\" Redistribute and revise at will.
8ff7380d 6.\" %%%LICENSE_END
fea681da 7.\"
4c1c5274 8.TH pts 4 (date) "Linux man-pages (unreleased)"
fea681da 9.SH NAME
b218b023 10ptmx, pts \- pseudoterminal master and slave
fea681da 11.SH DESCRIPTION
509e2056
MK
12The file
13.I /dev/ptmx
fac73de4 14(the pseudoterminal multiplexor device)
509e2056 15is a character file with major number 5 and
6f5b156b 16minor number 2, usually with mode 0666 and ownership root:root.
b218b023 17It is used to create a pseudoterminal master and slave pair.
fea681da 18.PP
509e2056
MK
19When a process opens
20.IR /dev/ptmx ,
21it gets a file
86e59106
MK
22descriptor for a pseudoterminal master
23and a pseudoterminal slave device is created in the
fea681da 24.I /dev/pts
c13182ef 25directory.
509e2056 26Each file descriptor obtained by opening
1ae6b2c7 27.I /dev/ptmx
86e59106
MK
28is an independent pseudoterminal master with its own associated slave,
29whose path can
d9cb0d7d 30be found by passing the file descriptor to
fea681da
MK
31.BR ptsname (3).
32.PP
b218b023 33Before opening the pseudoterminal slave, you must pass the master's file
fea681da
MK
34descriptor to
35.BR grantpt (3)
36and
37.BR unlockpt (3).
38.PP
b218b023 39Once both the pseudoterminal master and slave are open, the slave provides
fea681da
MK
40processes with an interface that is identical to that of a real terminal.
41.PP
d9cb0d7d 42Data written to the slave is presented on the master file descriptor as input.
fea681da
MK
43Data written to the master is presented to the slave as input.
44.PP
b218b023 45In practice, pseudoterminals are used for implementing terminal emulators
c13182ef 46such as
fea681da 47.BR xterm (1),
b218b023 48in which data read from the pseudoterminal master is interpreted by the
fea681da
MK
49application in the same way
50a real terminal would interpret the data, and for implementing remote-login
51programs such as
52.BR sshd (8),
b218b023 53in which data read from the pseudoterminal master is sent across the network
fea681da
MK
54to a client program that is connected to a terminal or terminal emulator.
55.PP
40a1b471 56Pseudoterminals can also be used to send input to programs that normally
fea681da 57refuse to read input from pipes (such as
49ec013c 58.BR su (1),
fea681da 59and
49ec013c 60.BR passwd (1)).
fea681da
MK
61.SH FILES
62.IR /dev/ptmx ,
63.I /dev/pts/*
64.SH NOTES
b218b023 65The Linux support for the above (known as UNIX 98 pseudoterminal naming)
fea681da
MK
66is done using the
67.I devpts
a3d59075 68filesystem, which should be mounted on
fea681da 69.IR /dev/pts .
47297adb 70.SH SEE ALSO
fea681da
MK
71.BR getpt (3),
72.BR grantpt (3),
73.BR ptsname (3),
88ab292b
MK
74.BR unlockpt (3),
75.BR pty (7)