1PTS(4)                     Linux Programmer's Manual                    PTS(4)
2
3
4

NAME

6       ptmx, pts - pseudoterminal master and slave
7

DESCRIPTION

9       The file /dev/ptmx (the pseudoterminal multiplexor device) is a charac‐
10       ter file with major number 5 and minor number 2, usually with mode 0666
11       and  ownership root:root.  It is used to create a pseudoterminal master
12       and slave pair.
13
14       When a process opens /dev/ptmx, it gets a file descriptor for  a  pseu‐
15       doterminal  master  and a pseudoterminal slave device is created in the
16       /dev/pts directory.  Each file descriptor obtained by opening /dev/ptmx
17       is  an independent pseudoterminal master with its own associated slave,
18       whose path can be found by passing the file descriptor to ptsname(3).
19
20       Before opening the pseudoterminal slave, you  must  pass  the  master's
21       file descriptor to grantpt(3) and unlockpt(3).
22
23       Once  both the pseudoterminal master and slave are open, the slave pro‐
24       vides processes with an interface that is identical to that of  a  real
25       terminal.
26
27       Data written to the slave is presented on the master file descriptor as
28       input.  Data written to the master is presented to the slave as input.
29
30       In practice, pseudoterminals are used for implementing terminal  emula‐
31       tors  such as xterm(1), in which data read from the pseudoterminal mas‐
32       ter is interpreted by the application in the same way a  real  terminal
33       would  interpret  the  data, and for implementing remote-login programs
34       such as sshd(8), in which data read from the pseudoterminal  master  is
35       sent across the network to a client program that is connected to a ter‐
36       minal or terminal emulator.
37
38       Pseudoterminals can also be used to send input to  programs  that  nor‐
39       mally refuse to read input from pipes (such as su(1), and passwd(1)).
40

FILES

42       /dev/ptmx, /dev/pts/*
43

NOTES

45       The  Linux  support for the above (known as UNIX 98 pseudoterminal nam‐
46       ing) is done using the devpts filesystem, which should  be  mounted  on
47       /dev/pts.
48

SEE ALSO

50       getpt(3), grantpt(3), ptsname(3), unlockpt(3), pty(7)
51

COLOPHON

53       This  page  is  part of release 5.10 of the Linux man-pages project.  A
54       description of the project, information about reporting bugs,  and  the
55       latest     version     of     this    page,    can    be    found    at
56       https://www.kernel.org/doc/man-pages/.
57
58
59
60Linux                             2020-08-13                            PTS(4)
Impressum