Team Ai
Apppublic

parthtamu/rag-code-assistant

sourceHugging Faceupdated 7mo agoView on Hugging Face
0likes
termios.html501 linesDownload Raw Back to docs
1<!DOCTYPE html>2 3<html lang="en" data-content_root="../">4  <head>5    <meta charset="utf-8" />6    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />7<meta property="og:title" content="termios — POSIX style tty control" />8<meta property="og:type" content="website" />9<meta property="og:url" content="https://docs.python.org/3/library/termios.html" />10<meta property="og:site_name" content="Python documentation" />11<meta property="og:description" content="This module provides an interface to the POSIX calls for tty I/O control. For a complete description of these calls, see termios(3) Unix manual page. It is only available for those Unix versions th..." />12<meta property="og:image:width" content="1146" />13<meta property="og:image:height" content="600" />14<meta property="og:image" content="https://docs.python.org/3.15/_images/social_previews/summary_library_termios_c36287ae.png" />15<meta property="og:image:alt" content="This module provides an interface to the POSIX calls for tty I/O control. For a complete description of these calls, see termios(3) Unix manual page. It is only available for those Unix versions th..." />16<meta name="description" content="This module provides an interface to the POSIX calls for tty I/O control. For a complete description of these calls, see termios(3) Unix manual page. It is only available for those Unix versions th..." />17<meta name="twitter:card" content="summary_large_image" />18<meta name="theme-color" content="#3776ab">19 20    <title>termios — POSIX style tty control &#8212; Python 3.15.0a6 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">21    22    <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=b86133f3" />23    <link rel="stylesheet" type="text/css" href="../_static/classic.css?v=234b1a7c" />24    <link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=89a2f22a" />25    <link rel="stylesheet" type="text/css" href="../_static/profiling-sampling-visualization.css?v=0c2600ae" />26    <link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=5349f25f" />27    28    <script src="../_static/documentation_options.js?v=6b7c9ff5"></script>29    <script src="../_static/doctools.js?v=9bcbadda"></script>30    <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>31    <script src="../_static/profiling-sampling-visualization.js?v=9811ed04"></script>32    33    <script src="../_static/sidebar.js"></script>34    35    <link rel="search" type="application/opensearchdescription+xml"36          title="Search within Python 3.15.0a6 documentation"37          href="../_static/opensearch.xml"/>38    <link rel="author" title="About these documents" href="../about.html" />39    <link rel="index" title="Index" href="../genindex.html" />40    <link rel="search" title="Search" href="../search.html" />41    <link rel="copyright" title="Copyright" href="../copyright.html" />42    <link rel="next" title="tty — Terminal control functions" href="tty.html" />43    <link rel="prev" title="grp — The group database" href="grp.html" />44    45      46      <script defer file-types="bz2,epub,zip" data-domain="docs.python.org" src="https://analytics.python.org/js/script.file-downloads.outbound-links.js"></script>47      48      <link rel="canonical" href="https://docs.python.org/3/library/termios.html">49      50    51 52    53    <style>54      @media only screen {55        table.full-width-table {56            width: 100%;57        }58      }59    </style>60<link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">61    <link rel="shortcut icon" type="image/png" href="../_static/py.svg">62            <script type="text/javascript" src="../_static/copybutton.js"></script>63            <script type="text/javascript" src="../_static/menu.js"></script>64            <script type="text/javascript" src="../_static/search-focus.js"></script>65            <script type="text/javascript" src="../_static/themetoggle.js"></script> 66            <script type="text/javascript" src="../_static/rtd_switcher.js"></script>67            <meta name="readthedocs-addons-api-version" content="1">68 69  </head>70<body>71<div class="mobile-nav">72    <input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"73           aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu">74    <nav class="nav-content" role="navigation">75        <label for="menuToggler" class="toggler__label">76            <span></span>77        </label>78        <span class="nav-items-wrapper">79            <a href="https://www.python.org/" class="nav-logo">80                <img src="../_static/py.svg" alt="Python logo">81            </a>82            <span class="version_switcher_placeholder"></span>83            <form role="search" class="search" action="../search.html" method="get">84                <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">85                    <path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>86                </svg>87                <input placeholder="Quick search" aria-label="Quick search" type="search" name="q">88                <input type="submit" value="Go">89            </form>90        </span>91    </nav>92    <div class="menu-wrapper">93        <nav class="menu" role="navigation" aria-label="main navigation">94            <div class="language_switcher_placeholder"></div>95            96<label class="theme-selector-label">97    Theme98    <select class="theme-selector" oninput="activateTheme(this.value)">99        <option value="auto" selected>Auto</option>100        <option value="light">Light</option>101        <option value="dark">Dark</option>102    </select>103</label>104  <div>105    <h3><a href="../contents.html">Table of Contents</a></h3>106    <ul>107<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">termios</span></code> — POSIX style tty control</a><ul>108<li><a class="reference internal" href="#example">Example</a></li>109</ul>110</li>111</ul>112 113  </div>114  <div>115    <h4>Previous topic</h4>116    <p class="topless"><a href="grp.html"117                          title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">grp</span></code> — The group database</a></p>118  </div>119  <div>120    <h4>Next topic</h4>121    <p class="topless"><a href="tty.html"122                          title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">tty</span></code> — Terminal control functions</a></p>123  </div>124  <script>125    document.addEventListener('DOMContentLoaded', () => {126        const title = document.querySelector('meta[property="og:title"]').content;127        const elements = document.querySelectorAll('.improvepage');128        const pageurl = window.location.href.split('?')[0];129        elements.forEach(element => {130            const url = new URL(element.href.split('?')[0].replace("-nojs", ""));131            url.searchParams.set('pagetitle', title);132            url.searchParams.set('pageurl', pageurl);133            url.searchParams.set('pagesource', "library/termios.rst");134            element.href = url.toString();135        });136    });137  </script>138  <div role="note" aria-label="source link">139    <h3>This page</h3>140    <ul class="this-page-menu">141      <li><a href="../bugs.html">Report a bug</a></li>142      <li><a class="improvepage" href="../improve-page-nojs.html">Improve this page</a></li>143      <li>144        <a href="https://github.com/python/cpython/blob/main/Doc/library/termios.rst?plain=1"145            rel="nofollow">Show source146        </a>147      </li>148      149    </ul>150  </div>151        </nav>152    </div>153</div>154 155  156    <div class="related" role="navigation" aria-label="Related">157      <h3>Navigation</h3>158      <ul>159        <li class="right" style="margin-right: 10px">160          <a href="../genindex.html" title="General Index"161             accesskey="I">index</a></li>162        <li class="right" >163          <a href="../py-modindex.html" title="Python Module Index"164             >modules</a> |</li>165        <li class="right" >166          <a href="tty.html" title="tty — Terminal control functions"167             accesskey="N">next</a> |</li>168        <li class="right" >169          <a href="grp.html" title="grp — The group database"170             accesskey="P">previous</a> |</li>171 172          <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"></li>173          <li><a href="https://www.python.org/">Python</a> &#187;</li>174          <li class="switchers">175            <div class="language_switcher_placeholder"></div>176            <div class="version_switcher_placeholder"></div>177          </li>178          <li>179              180          </li>181    <li id="cpython-language-and-version">182      <a href="../index.html">3.15.0a6 Documentation</a> &#187;183    </li>184 185          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>186          <li class="nav-item nav-item-2"><a href="unix.html" accesskey="U">Unix-specific services</a> &#187;</li>187        <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">termios</span></code> — POSIX style tty control</a></li>188                <li class="right">189                    190 191    <div class="inline-search" role="search">192        <form class="inline-search" action="../search.html" method="get">193          <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box">194          <input type="submit" value="Go">195        </form>196    </div>197                     |198                </li>199            <li class="right">200<label class="theme-selector-label">201    Theme202    <select class="theme-selector" oninput="activateTheme(this.value)">203        <option value="auto" selected>Auto</option>204        <option value="light">Light</option>205        <option value="dark">Dark</option>206    </select>207</label> |</li>208            209      </ul>210    </div>    211 212    <div class="document">213      <div class="documentwrapper">214        <div class="bodywrapper">215          <div class="body" role="main">216            217  <section id="module-termios">218<span id="termios-posix-style-tty-control"></span><h1><code class="xref py py-mod docutils literal notranslate"><span class="pre">termios</span></code> — POSIX style tty control<a class="headerlink" href="#module-termios" title="Link to this heading">¶</a></h1>219<hr class="docutils" id="index-0" />220<p>This module provides an interface to the POSIX calls for tty I/O control. For a221complete description of these calls, see <em class="manpage"><a class="manpage reference external" href="https://manpages.debian.org/termios(3)">termios(3)</a></em> Unix manual222page.  It is only available for those Unix versions that support POSIX223<em>termios</em> style tty I/O control configured during installation.</p>224<div class="availability docutils container">225<p><a class="reference internal" href="intro.html#availability"><span class="std std-ref">Availability</span></a>: Unix.</p>226</div>227<p>All functions in this module take a file descriptor <em>fd</em> as their first228argument.  This can be an integer file descriptor, such as returned by229<code class="docutils literal notranslate"><span class="pre">sys.stdin.fileno()</span></code>, or a <a class="reference internal" href="../glossary.html#term-file-object"><span class="xref std std-term">file object</span></a>, such as <code class="docutils literal notranslate"><span class="pre">sys.stdin</span></code> itself.</p>230<p>This module also defines all the constants needed to work with the functions231provided here; these have the same name as their counterparts in C.  Please232refer to your system documentation for more information on using these terminal233control interfaces.</p>234<p>The module defines the following functions:</p>235<dl class="py function">236<dt class="sig sig-object py" id="termios.tcgetattr">237<span class="sig-prename descclassname"><span class="pre">termios.</span></span><span class="sig-name descname"><span class="pre">tcgetattr</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fd</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#termios.tcgetattr" title="Link to this definition">¶</a></dt>238<dd><p>Return a list containing the tty attributes for file descriptor <em>fd</em>, as239follows: <code class="docutils literal notranslate"><span class="pre">[iflag,</span> <span class="pre">oflag,</span> <span class="pre">cflag,</span> <span class="pre">lflag,</span> <span class="pre">ispeed,</span> <span class="pre">ospeed,</span> <span class="pre">cc]</span></code> where <em>cc</em> is a240list of the tty special characters (each a string of length 1, except the241items with indices <code class="xref py py-const docutils literal notranslate"><span class="pre">VMIN</span></code> and <code class="xref py py-const docutils literal notranslate"><span class="pre">VTIME</span></code>, which are integers when242these fields are defined).  The interpretation of the flags and the speeds as243well as the indexing in the <em>cc</em> array must be done using the symbolic244constants defined in the <code class="xref py py-mod docutils literal notranslate"><span class="pre">termios</span></code> module.</p>245</dd></dl>246 247<dl class="py function">248<dt class="sig sig-object py" id="termios.tcsetattr">249<span class="sig-prename descclassname"><span class="pre">termios.</span></span><span class="sig-name descname"><span class="pre">tcsetattr</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fd</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">when</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">attributes</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#termios.tcsetattr" title="Link to this definition">¶</a></dt>250<dd><p>Set the tty attributes for file descriptor <em>fd</em> from the <em>attributes</em>, which is251a list like the one returned by <a class="reference internal" href="#termios.tcgetattr" title="termios.tcgetattr"><code class="xref py py-func docutils literal notranslate"><span class="pre">tcgetattr()</span></code></a>.  The <em>when</em> argument252determines when the attributes are changed:</p>253<dl class="py data">254<dt class="sig sig-object py" id="termios.TCSANOW">255<span class="sig-prename descclassname"><span class="pre">termios.</span></span><span class="sig-name descname"><span class="pre">TCSANOW</span></span><a class="headerlink" href="#termios.TCSANOW" title="Link to this definition">¶</a></dt>256<dd><p>Change attributes immediately.</p>257</dd></dl>258 259<dl class="py data">260<dt class="sig sig-object py" id="termios.TCSADRAIN">261<span class="sig-prename descclassname"><span class="pre">termios.</span></span><span class="sig-name descname"><span class="pre">TCSADRAIN</span></span><a class="headerlink" href="#termios.TCSADRAIN" title="Link to this definition">¶</a></dt>262<dd><p>Change attributes after transmitting all queued output.</p>263</dd></dl>264 265<dl class="py data">266<dt class="sig sig-object py" id="termios.TCSAFLUSH">267<span class="sig-prename descclassname"><span class="pre">termios.</span></span><span class="sig-name descname"><span class="pre">TCSAFLUSH</span></span><a class="headerlink" href="#termios.TCSAFLUSH" title="Link to this definition">¶</a></dt>268<dd><p>Change attributes after transmitting all queued output and269discarding all queued input.</p>270</dd></dl>271 272</dd></dl>273 274<dl class="py function">275<dt class="sig sig-object py" id="termios.tcsendbreak">276<span class="sig-prename descclassname"><span class="pre">termios.</span></span><span class="sig-name descname"><span class="pre">tcsendbreak</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fd</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">duration</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#termios.tcsendbreak" title="Link to this definition">¶</a></dt>277<dd><p>Send a break on file descriptor <em>fd</em>.  A zero <em>duration</em> sends a break for2780.25–0.5 seconds; a nonzero <em>duration</em> has a system dependent meaning.</p>279</dd></dl>280 281<dl class="py function">282<dt class="sig sig-object py" id="termios.tcdrain">283<span class="sig-prename descclassname"><span class="pre">termios.</span></span><span class="sig-name descname"><span class="pre">tcdrain</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fd</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#termios.tcdrain" title="Link to this definition">¶</a></dt>284<dd><p>Wait until all output written to file descriptor <em>fd</em> has been transmitted.</p>285</dd></dl>286 287<dl class="py function">288<dt class="sig sig-object py" id="termios.tcflush">289<span class="sig-prename descclassname"><span class="pre">termios.</span></span><span class="sig-name descname"><span class="pre">tcflush</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fd</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">queue</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#termios.tcflush" title="Link to this definition">¶</a></dt>290<dd><p>Discard queued data on file descriptor <em>fd</em>.  The <em>queue</em> selector specifies291which queue: <code class="xref py py-const docutils literal notranslate"><span class="pre">TCIFLUSH</span></code> for the input queue, <code class="xref py py-const docutils literal notranslate"><span class="pre">TCOFLUSH</span></code> for the292output queue, or <code class="xref py py-const docutils literal notranslate"><span class="pre">TCIOFLUSH</span></code> for both queues.</p>293</dd></dl>294 295<dl class="py function">296<dt class="sig sig-object py" id="termios.tcflow">297<span class="sig-prename descclassname"><span class="pre">termios.</span></span><span class="sig-name descname"><span class="pre">tcflow</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fd</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">action</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#termios.tcflow" title="Link to this definition">¶</a></dt>298<dd><p>Suspend or resume input or output on file descriptor <em>fd</em>.  The <em>action</em>299argument can be <code class="xref py py-const docutils literal notranslate"><span class="pre">TCOOFF</span></code> to suspend output, <code class="xref py py-const docutils literal notranslate"><span class="pre">TCOON</span></code> to restart300output, <code class="xref py py-const docutils literal notranslate"><span class="pre">TCIOFF</span></code> to suspend input, or <code class="xref py py-const docutils literal notranslate"><span class="pre">TCION</span></code> to restart input.</p>301</dd></dl>302 303<dl class="py function">304<dt class="sig sig-object py" id="termios.tcgetwinsize">305<span class="sig-prename descclassname"><span class="pre">termios.</span></span><span class="sig-name descname"><span class="pre">tcgetwinsize</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fd</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#termios.tcgetwinsize" title="Link to this definition">¶</a></dt>306<dd><p>Return a tuple <code class="docutils literal notranslate"><span class="pre">(ws_row,</span> <span class="pre">ws_col)</span></code> containing the tty window size for file307descriptor <em>fd</em>. Requires <code class="xref py py-const docutils literal notranslate"><span class="pre">termios.TIOCGWINSZ</span></code> or308<code class="xref py py-const docutils literal notranslate"><span class="pre">termios.TIOCGSIZE</span></code>.</p>309<div class="versionadded">310<p><span class="versionmodified added">Added in version 3.11.</span></p>311</div>312</dd></dl>313 314<dl class="py function">315<dt class="sig sig-object py" id="termios.tcsetwinsize">316<span class="sig-prename descclassname"><span class="pre">termios.</span></span><span class="sig-name descname"><span class="pre">tcsetwinsize</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fd</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">winsize</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#termios.tcsetwinsize" title="Link to this definition">¶</a></dt>317<dd><p>Set the tty window size for file descriptor <em>fd</em> from <em>winsize</em>, which is318a two-item tuple <code class="docutils literal notranslate"><span class="pre">(ws_row,</span> <span class="pre">ws_col)</span></code> like the one returned by319<a class="reference internal" href="#termios.tcgetwinsize" title="termios.tcgetwinsize"><code class="xref py py-func docutils literal notranslate"><span class="pre">tcgetwinsize()</span></code></a>. Requires at least one of the pairs320(<code class="xref py py-const docutils literal notranslate"><span class="pre">termios.TIOCGWINSZ</span></code>, <code class="xref py py-const docutils literal notranslate"><span class="pre">termios.TIOCSWINSZ</span></code>);321(<code class="xref py py-const docutils literal notranslate"><span class="pre">termios.TIOCGSIZE</span></code>, <code class="xref py py-const docutils literal notranslate"><span class="pre">termios.TIOCSSIZE</span></code>) to be defined.</p>322<div class="versionadded">323<p><span class="versionmodified added">Added in version 3.11.</span></p>324</div>325</dd></dl>326 327<div class="admonition seealso">328<p class="admonition-title">See also</p>329<dl class="simple">330<dt>Module <a class="reference internal" href="tty.html#module-tty" title="tty: Utility functions that perform common terminal control operations."><code class="xref py py-mod docutils literal notranslate"><span class="pre">tty</span></code></a></dt><dd><p>Convenience functions for common terminal control operations.</p>331</dd>332</dl>333</div>334<section id="example">335<span id="termios-example"></span><h2>Example<a class="headerlink" href="#example" title="Link to this heading">¶</a></h2>336<p>Here’s a function that prompts for a password with echoing turned off.  Note the337technique using a separate <a class="reference internal" href="#termios.tcgetattr" title="termios.tcgetattr"><code class="xref py py-func docutils literal notranslate"><span class="pre">tcgetattr()</span></code></a> call and a <a class="reference internal" href="../reference/compound_stmts.html#try"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">try</span></code></a> …338<a class="reference internal" href="../reference/compound_stmts.html#finally"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">finally</span></code></a> statement to ensure that the old tty attributes are restored339exactly no matter what happens:</p>340<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="k">def</span><span class="w"> </span><span class="nf">getpass</span><span class="p">(</span><span class="n">prompt</span><span class="o">=</span><span class="s2">&quot;Password: &quot;</span><span class="p">):</span>341    <span class="kn">import</span><span class="w"> </span><span class="nn">termios</span><span class="o">,</span><span class="w"> </span><span class="nn">sys</span>342    <span class="n">fd</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">stdin</span><span class="o">.</span><span class="n">fileno</span><span class="p">()</span>343    <span class="n">old</span> <span class="o">=</span> <span class="n">termios</span><span class="o">.</span><span class="n">tcgetattr</span><span class="p">(</span><span class="n">fd</span><span class="p">)</span>344    <span class="n">new</span> <span class="o">=</span> <span class="n">termios</span><span class="o">.</span><span class="n">tcgetattr</span><span class="p">(</span><span class="n">fd</span><span class="p">)</span>345    <span class="n">new</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">=</span> <span class="n">new</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">&amp;</span> <span class="o">~</span><span class="n">termios</span><span class="o">.</span><span class="n">ECHO</span>          <span class="c1"># lflags</span>346    <span class="k">try</span><span class="p">:</span>347        <span class="n">termios</span><span class="o">.</span><span class="n">tcsetattr</span><span class="p">(</span><span class="n">fd</span><span class="p">,</span> <span class="n">termios</span><span class="o">.</span><span class="n">TCSADRAIN</span><span class="p">,</span> <span class="n">new</span><span class="p">)</span>348        <span class="n">passwd</span> <span class="o">=</span> <span class="nb">input</span><span class="p">(</span><span class="n">prompt</span><span class="p">)</span>349    <span class="k">finally</span><span class="p">:</span>350        <span class="n">termios</span><span class="o">.</span><span class="n">tcsetattr</span><span class="p">(</span><span class="n">fd</span><span class="p">,</span> <span class="n">termios</span><span class="o">.</span><span class="n">TCSADRAIN</span><span class="p">,</span> <span class="n">old</span><span class="p">)</span>351    <span class="k">return</span> <span class="n">passwd</span>352</pre></div>353</div>354</section>355</section>356 357 358            <div class="clearer"></div>359          </div>360        </div>361      </div>362      <div class="sphinxsidebar" role="navigation" aria-label="Main">363        <div class="sphinxsidebarwrapper">364  <div>365    <h3><a href="../contents.html">Table of Contents</a></h3>366    <ul>367<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">termios</span></code> — POSIX style tty control</a><ul>368<li><a class="reference internal" href="#example">Example</a></li>369</ul>370</li>371</ul>372 373  </div>374  <div>375    <h4>Previous topic</h4>376    <p class="topless"><a href="grp.html"377                          title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">grp</span></code> — The group database</a></p>378  </div>379  <div>380    <h4>Next topic</h4>381    <p class="topless"><a href="tty.html"382                          title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">tty</span></code> — Terminal control functions</a></p>383  </div>384  <script>385    document.addEventListener('DOMContentLoaded', () => {386        const title = document.querySelector('meta[property="og:title"]').content;387        const elements = document.querySelectorAll('.improvepage');388        const pageurl = window.location.href.split('?')[0];389        elements.forEach(element => {390            const url = new URL(element.href.split('?')[0].replace("-nojs", ""));391            url.searchParams.set('pagetitle', title);392            url.searchParams.set('pageurl', pageurl);393            url.searchParams.set('pagesource', "library/termios.rst");394            element.href = url.toString();395        });396    });397  </script>398  <div role="note" aria-label="source link">399    <h3>This page</h3>400    <ul class="this-page-menu">401      <li><a href="../bugs.html">Report a bug</a></li>402      <li><a class="improvepage" href="../improve-page-nojs.html">Improve this page</a></li>403      <li>404        <a href="https://github.com/python/cpython/blob/main/Doc/library/termios.rst?plain=1"405            rel="nofollow">Show source406        </a>407      </li>408      409    </ul>410  </div>411        </div>412<div id="sidebarbutton" title="Collapse sidebar">413<span>«</span>414</div>415 416      </div>417      <div class="clearer"></div>418    </div>  419    <div class="related" role="navigation" aria-label="Related">420      <h3>Navigation</h3>421      <ul>422        <li class="right" style="margin-right: 10px">423          <a href="../genindex.html" title="General Index"424             >index</a></li>425        <li class="right" >426          <a href="../py-modindex.html" title="Python Module Index"427             >modules</a> |</li>428        <li class="right" >429          <a href="tty.html" title="tty — Terminal control functions"430             >next</a> |</li>431        <li class="right" >432          <a href="grp.html" title="grp — The group database"433             >previous</a> |</li>434 435          <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"></li>436          <li><a href="https://www.python.org/">Python</a> &#187;</li>437          <li class="switchers">438            <div class="language_switcher_placeholder"></div>439            <div class="version_switcher_placeholder"></div>440          </li>441          <li>442              443          </li>444    <li id="cpython-language-and-version">445      <a href="../index.html">3.15.0a6 Documentation</a> &#187;446    </li>447 448          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>449          <li class="nav-item nav-item-2"><a href="unix.html" >Unix-specific services</a> &#187;</li>450        <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">termios</span></code> — POSIX style tty control</a></li>451                <li class="right">452                    453 454    <div class="inline-search" role="search">455        <form class="inline-search" action="../search.html" method="get">456          <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box">457          <input type="submit" value="Go">458        </form>459    </div>460                     |461                </li>462            <li class="right">463<label class="theme-selector-label">464    Theme465    <select class="theme-selector" oninput="activateTheme(this.value)">466        <option value="auto" selected>Auto</option>467        <option value="light">Light</option>468        <option value="dark">Dark</option>469    </select>470</label> |</li>471            472      </ul>473    </div>  474    <div class="footer">475    &copy; <a href="../copyright.html">Copyright</a> 2001 Python Software Foundation.476    <br>477    This page is licensed under the Python Software Foundation License Version 2.478    <br>479    Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.480    <br>481    482      See <a href="/license.html">History and License</a> for more information.<br>483    484    485    <br>486 487    The Python Software Foundation is a non-profit corporation.488<a href="https://www.python.org/psf/donations/">Please donate.</a>489<br>490    <br>491      Last updated on Mar 10, 2026 (08:58 UTC).492    493      <a href="/bugs.html">Found a bug</a>?494    495    <br>496 497    Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.498    </div>499 500  </body>501</html>