cbreak - Linux


cbreak is a command used to set or clear the state of the terminal input mode known as cbreak mode. This mode alters the behavior of the terminal, affecting how input is handled and displayed.


cbreak [-l]
cbreak [-r] [-u speed]


  • -l: Lists the supported terminal input modes.
  • -r: Resets the terminal input mode to its default settings.
  • -u speed: Sets the terminal input speed to speed in baud (bits per second).


Activate cbreak mode:


List supported terminal input modes:

cbreak -l

Restore default terminal input mode:

cbreak -r

Set terminal input speed to 9600 baud:

cbreak -u 9600

Common Issues

  • Input not echoing: Ensure that cbreak mode is activated by running cbreak.
  • Incorrect input speed: Verify the baud rate of the connected device and set it accordingly using -u.
  • Terminal not responding: Use stty sane to reset the terminal to a known state.


  • Use cbreak in scripts to temporarily modify the terminal input behavior (e.g., for capturing raw keyboard input).
  • Combine cbreak with tee to log and modify input data in real-time.

Related Commands

  • stty: Modifies terminal settings, including input modes.
  • tput: Controls terminal output, including character handling.
  • cat: Concatenates and prints files, can be used to display raw input data.