termios.h(0P)
πΈ termios.h(0P) β POSIX Programmer's Manual πΈ
okay bestie, welcome to the terminal-I/O header of your DREAMS. this page is termios.h(0P) from the POSIX Programmer's Manual, and it's giving "everything you need to boss your terminal around". buckle up π«Ά
β¨ PROLOG β¨
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.
π bestie. "may differ" and "may not be implemented on Linux" β read those words twice, they are NOT decorative.
π NAME π
termios.h β define values for termios
π SYNOPSIS π
#include <termios.h>
π DESCRIPTION π
The <termios.h> header shall contain the definitions used by the terminal I/O interfaces (see Chapter 11, General Terminal Interface for the structures and names defined).
π¦ The termios Structure π¦
The <termios.h> header shall define the following data types through typedef:
cc_tβ Used for terminal special characters.speed_tβ Used for terminal baud rates.tcflag_tβ Used for terminal modes.
The above types shall be all unsigned integer types.
The implementation shall support one or more programming environments in which the widths of cc_t, speed_t, and tcflag_t are no greater than the width of type long. The names of these programming environments can be obtained using the confstr() function or the getconf utility.
The <termios.h> header shall define the termios structure, which shall include at least the following members:
tcflag_t c_iflag Input modes.
tcflag_t c_oflag Output modes.
tcflag_t c_cflag Control modes.
tcflag_t c_lflag Local modes.
cc_t c_cc[NCCS] Control characters.
The <termios.h> header shall define the following symbolic constant:
NCCSβ Size of the arrayc_ccfor control characters.
The <termios.h> header shall define the following symbolic constants for use as subscripts for the array c_cc. The table is serving two modes at once, so here's the whole vibe laid out flat π
β first the ones you use in canonical mode, then the ones in non-canonical mode, then the tea:
VEOFβ Canonical Mode. EOF character.VEOLβ Canonical Mode. EOL character.VERASEβ Canonical Mode. ERASE character.VINTRβ Canonical Mode and Non-Canonical Mode. INTR character.VKILLβ Canonical Mode. KILL character.VMINβ Non-Canonical Mode. MIN value.VQUITβ Canonical Mode and Non-Canonical Mode. QUIT character.VSTARTβ Canonical Mode and Non-Canonical Mode. START character.VSTOPβ Canonical Mode and Non-Canonical Mode. STOP character.VSUSPβ Canonical Mode and Non-Canonical Mode. SUSP character.VTIMEβ Non-Canonical Mode. TIME value.
The subscript values shall be suitable for use in #if preprocessing directives and shall be distinct, except that the VMIN and VTIME subscripts may have the same values as the VEOF and VEOL subscripts, respectively.
β Input Modes β
The <termios.h> header shall define the following symbolic constants for use as flags in the c_iflag field. The c_iflag field describes the basic terminal input control.
BRKINTβ Signal interrupt on break.ICRNLβ Map CR to NL on input.IGNBRKβ Ignore break condition.IGNCRβ Ignore CR.IGNPARβ Ignore characters with parity errors.INLCRβ Map NL to CR on input.INPCKβ Enable input parity check.ISTRIPβ Strip character.IXANYβ Enable any character to restart output.IXOFFβ Enable start/stop input control.IXONβ Enable start/stop output control.PARMRKβ Mark parity errors.
π Output Modes π
The <termios.h> header shall define the following symbolic constants for use as flags in the c_oflag field. The c_oflag field specifies the system treatment of output.
OPOSTβ Post-process output.ONLCRβ Map NL to CR-NL on output.OCRNLβ Map CR to NL on output.ONOCRβ No CR output at column 0.ONLRETβ NL performs CR function.OFDELβ Fill is DEL.OFILLβ Use fill characters for delay.NLDLYβ Select newline delays:NL0β Newline type 0.NL1β Newline type 1.
CRDLYβ Select carriage-return delays:CR0β Carriage-return delay type 0.CR1β Carriage-return delay type 1.CR2β Carriage-return delay type 2.CR3β Carriage-return delay type 3.
TABDLYβ Select horizontal-tab delays:TAB0β Horizontal-tab delay type 0.TAB1β Horizontal-tab delay type 1.TAB2β Horizontal-tab delay type 2.TAB3β Expand tabs to spaces.
BSDLYβ Select backspace delays:BS0β Backspace-delay type 0.BS1β Backspace-delay type 1.
VTDLYβ Select vertical-tab delays:VT0β Vertical-tab delay type 0.VT1β Vertical-tab delay type 1.
FFDLYβ Select form-feed delays:FF0β Form-feed delay type 0.FF1β Form-feed delay type 1.
π§ Baud Rate Selection π§
The <termios.h> header shall define the following symbolic constants for use as values of objects of type speed_t.
The input and output baud rates are stored in the termios structure. These are the valid values for objects of type speed_t. Not all baud rates need be supported by the underlying hardware.
π read that last sentence again before you come for your hardware, bestie. it's not obligated to serve every single one of these.
B0β Hang upB50β 50 baudB75β 75 baudB110β 110 baudB134β 134.5 baudB150β 150 baudB200β 200 baudB300β 300 baudB600β 600 baudB1200β 1200 baudB1800β 1800 baudB2400β 2400 baudB4800β 4800 baudB9600β 9600 baudB19200β 19200 baudB38400β 38400 baud
π Control Modes π
The <termios.h> header shall define the following symbolic constants for use as flags in the c_cflag field. The c_cflag field describes the hardware control of the terminal; not all values specified are required to be supported by the underlying hardware.
CSIZEβ Character size:CS5β 5 bitsCS6β 6 bitsCS7β 7 bitsCS8β 8 bits
CSTOPBβ Send two stop bits, else one.CREADβ Enable receiver.PARENBβ Parity enable.PARODDβ Odd parity, else even.HUPCLβ Hang up on last close.CLOCALβ Ignore modem status lines.
The implementation shall support the functionality associated with the symbols CS7, CS8, CSTOPB, PARODD, and PARENB.
π Local Modes π
The <termios.h> header shall define the following symbolic constants for use as flags in the c_lflag field. The c_lflag field of the argument structure is used to control various terminal functions.
ECHOβ Enable echo.ECHOEβ Echo erase character as error-correcting backspace.ECHOKβ Echo KILL.ECHONLβ Echo NL.ICANONβ Canonical input (erase and kill processing).IEXTENβ Enable extended input character processing.ISIGβ Enable signals.NOFLSHβ Disable flush after interrupt or quit.TOSTOPβ SendSIGTTOUfor background output.
π Attribute Selection π
The <termios.h> header shall define the following symbolic constants for use with tcsetattr():
TCSANOWβ Change attributes immediately.TCSADRAINβ Change attributes when output has drained.TCSAFLUSHβ Change attributes when output has drained; also flush pending input.
πΈ Line Control πΈ
The <termios.h> header shall define the following symbolic constants for use with tcflush():
TCIFLUSHβ Flush pending input.TCIOFLUSHβ Flush both pending input and untransmitted output.TCOFLUSHβ Flush untransmitted output.
The <termios.h> header shall define the following symbolic constants for use with tcflow():
TCIOFFβ Transmit a STOP character, intended to suspend input data.TCIONβ Transmit a START character, intended to restart input data.TCOOFFβ Suspend output.TCOONβ Restart output.
The <termios.h> header shall define the pid_t type as described in <sys/types.h>.
The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.
speed_t cfgetispeed(const struct termios *);
speed_t cfgetospeed(const struct termios *);
int cfsetispeed(struct termios *, speed_t);
int cfsetospeed(struct termios *, speed_t);
int tcdrain(int);
int tcflow(int, int);
int tcflush(int, int);
int tcgetattr(int, struct termios *);
pid_t tcgetsid(int);
int tcsendbreak(int, int);
int tcsetattr(int, int, const struct termios *);
The following sections are informative.
π«Ά APPLICATION USAGE π«Ά
The following names are reserved for XSI-conformant systems to use as an extension to the above; therefore strictly conforming applications shall not use them:
CBAUD EXTB VDSUSP
DEFECHO FLUSHO VLNEXT
ECHOCTL LOBLK VREPRINT
ECHOKE PENDIN VSTATUS
ECHOPRT SWTCH VWERASE
EXTA VDISCARD
π bestie do NOT touch these names. they're reserved. that's the whole point. hands off the keyboard.
π RATIONALE π
None.
π FUTURE DIRECTIONS π
None.
π₯ SEE ALSO π₯
<sys_types.h>- The System Interfaces volume of POSIX.1β2017,
cfgetispeed(),cfgetospeed(),cfsetispeed(),cfsetospeed(),confstr(),tcdrain(),tcflow(),tcflush(),tcgetattr(),tcgetsid(),tcsendbreak(),tcsetattr() - The Shell and Utilities volume of POSIX.1β2017, Chapter 11, General Terminal Interface,
getconf
π COPYRIGHT π
Okay bestie, legal era incoming, but stay with me because this part actually matters. π
Some of this text is reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. Periodt. β¨
π¨ And here's the part you don't skip, bestie: if this version and the original IEEE and The Open Group Standard ever disagree about anything, the original IEEE and The Open Group Standard is the referee document. Like, it wins. No debate, no discourse, the original ate and it's the final word. π€
The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . π
And listen β any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. π Not the standard's fault, not your fave's fault, it's the conversion's fault, fr fr. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html . π«Ά
π that's the whole page, bestie π
We did it. Every flag, every struct, every little nuance β all of it. Slay. π
Oh and for the record, this came to you courtesy of IEEE/The Open Group, dated 2017, and it lives under the name termios.h(0P). Iconic lineage honestly. π
Go forth and configure your terminals, main character. πΈπ¦π
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms