pty(7)


NAME

   pty - pseudoterminal interfaces

DESCRIPTION

   A  pseudoterminal  (sometimes  abbreviated  "pty") is a pair of virtual
   character devices that provide a bidirectional  communication  channel.
   One  end  of  the channel is called the master; the other end is called
   the slave.  The slave end of the pseudoterminal provides  an  interface
   that behaves exactly like a classical terminal.  A process that expects
   to  be  connected  to  a  terminal,  can  open  the  slave  end  of   a
   pseudoterminal  and  then  be  driven  by a program that has opened the
   master end.  Anything that is written on the master end is provided  to
   the  process  on  the  slave  end  as  though  it  was input typed on a
   terminal.   For  example,  writing  the  interrupt  character  (usually
   control-C)  to  the  master  device  would  cause  an  interrupt signal
   (SIGINT) to be generated for  the  foreground  process  group  that  is
   connected  to  the  slave.  Conversely, anything that is written to the
   slave end of the pseudoterminal can be read  by  the  process  that  is
   connected  to the master end.  Pseudoterminals are used by applications
   such as network login services (ssh(1), rlogin(1), telnet(1)), terminal
   emulators, script(1), screen(1), and expect(1).

   Data flow between master and slave is handled asynchronously, much like
   data flow with a physical terminal.  Data written to the slave will  be
   available at the master promptly, but may not be available immediately.
   Similarly, there may be a small processing delay between a write to the
   master, and the effect being visible at the slave.

   Historically,  two  pseudoterminal APIs have evolved: BSD and System V.
   SUSv1 standardized a pseudoterminal API based on the System V API,  and
   this   API   should   be   employed   in  all  new  programs  that  use
   pseudoterminals.

   Linux  provides  both  BSD-style  and  (standardized)  System   V-style
   pseudoterminals.   System V-style terminals are commonly called UNIX 98
   pseudoterminals  on  Linux  systems.   Since  kernel  2.6.4,  BSD-style
   pseudoterminals  are  considered  deprecated (they can be disabled when
   configuring the kernel); UNIX 98 pseudoterminals should be used in  new
   applications.

   UNIX 98 pseudoterminals
   An   unused   UNIX  98  pseudoterminal  master  is  opened  by  calling
   posix_openpt(3).   (This  function  opens  the  master  clone   device,
   /dev/ptmx;   see   pts(4).)    After  performing  any  program-specific
   initializations, changing the ownership and permissions  of  the  slave
   device  using  grantpt(3),  and unlocking the slave using unlockpt(3)),
   the corresponding slave device  can  be  opened  by  passing  the  name
   returned by ptsname(3) in a call to open(2).

   The  Linux  kernel  imposes  a limit on the number of available UNIX 98
   pseudoterminals.  In kernels up to and including 2.6.3, this  limit  is
   configured  at  kernel  compilation  time (CONFIG_UNIX98_PTYS), and the
   permitted number of pseudoterminals can be up to 2048, with  a  default
   setting   of  256.   Since  kernel  2.6.4,  the  limit  is  dynamically
   adjustable via  /proc/sys/kernel/pty/max,  and  a  corresponding  file,
   /proc/sys/kernel/pty/nr,   indicates   how   many  pseudoterminals  are
   currently in use.  For further details on these two files, see proc(5).

   BSD pseudoterminals
   BSD-style pseudoterminals are provided as precreated pairs, with  names
   of  the  form  /dev/ptyXY (master) and /dev/ttyXY (slave), where X is a
   letter from the 16-character set [p-za-e], and Y is a letter  from  the
   16-character  set [0-9a-f].  (The precise range of letters in these two
   sets varies across UNIX implementations.)  For example, /dev/ptyp1  and
   /dev/ttyp1  constitute  a  BSD pseudoterminal pair.  A process finds an
   unused pseudoterminal pair by trying  to  open(2)  each  pseudoterminal
   master  until an open succeeds.  The corresponding pseudoterminal slave
   (substitute "tty" for "pty" in the name of  the  master)  can  then  be
   opened.

FILES

   /dev/ptmx (UNIX 98 master clone device)
   /dev/pts/* (UNIX 98 slave devices)
   /dev/pty[p-za-e][0-9a-f] (BSD master devices)
   /dev/tty[p-za-e][0-9a-f] (BSD slave devices)

NOTES

   A  description  of  the  TIOCPKT  ioctl(2),  which controls packet mode
   operation, can be found in tty_ioctl(4).

   The  BSD  ioctl(2)  operations  TIOCSTOP,  TIOCSTART,  TIOCUCNTL,   and
   TIOCREMOTE have not been implemented under Linux.

SEE ALSO

   select(2),   setsid(2),  forkpty(3),  openpty(3),  termios(3),  pts(4),
   tty(4), tty_ioctl(4)

COLOPHON

   This page is part of release 4.09 of the Linux  man-pages  project.   A
   description  of  the project, information about reporting bugs, and the
   latest    version    of    this    page,    can     be     found     at
   https://www.kernel.org/doc/man-pages/.





Opportunity


Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.

Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.





Free Software


Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.


Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.





Free Books


The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.


Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.





Education


Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.


Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.