Aterminal mode is one of a set of possible states of aterminal orpseudo terminalcharacter device inUnix-like systems and determines how characters written to the terminal are interpreted. Incooked mode data ispreprocessed before being given to a program, whileraw mode passes the data as-is to the program without interpreting any of the special characters.
The system intercepts special characters in cooked mode and interprets special meaning from them.Backspace,delete, andControl-D are typically used to enableline-editing for the input to the running programs, and othercontrol characters such asControl-C andControl-Z are used forjob control or associated with othersignals. The precise definition of what constitutes a cooked mode isoperating system-specific.[1]
For example, if "ABC<Backspace>D" is given as an input to a program through a terminal character device in cooked mode, the program gets "ABD". But, if the terminal is in raw mode, the program gets the characters "ABC" followed by theBackspace character and followed by "D". In cooked mode, theterminal line discipline processes the characters "ABC<Backspace>D" and presents only the result ("ABD") to the program.
Technically, the term "cooked mode" should be associated only withstreams that have a terminalline discipline, but generally it is applied to anysystem that does some amount of preprocessing.[2]
cbreak mode (sometimes calledrare mode) is a mode betweenraw mode and cooked mode. Unlike cooked mode it works with single characters at a time, rather than forcing a wait for a whole line and then feeding the line in all at once. Unlike raw mode,keystrokes like abort (usuallyControl-C) are still processed by the terminal and will interrupt the process.
![]() | Thisprogramming-language-related article is astub. You can help Wikipedia byexpanding it. |