47

From here I understand that to disable Ctrl+S the stty -ixon command can be used and it works, but as soon as I close the terminal and open another I have to re-enter the command.

To permanently disable Ctrl+S I have made a startup.sh that contains the stty -ixon command and run it with crontab at @reboot but it does not work.

So what will be the solution to permanently disable Ctrl+S?

2
  • 3
    Reminder: if you hit CTRL+S by mistake, you can use CTRL+Q to restore data flow from the terminal.
    – jjmontes
    Dec 26, 2016 at 14:15
  • 5
    The reason your startup.sh does not work, but the accepted answer does work, is that it has to be done every time a new (pseudo)terminal is activated.
    – zwol
    Dec 27, 2016 at 4:20

3 Answers 3

58

To disable Ctrl-s permanently in terminal just add this line at the end of your .bashrc script (generally in your home directory)

stty -ixon

An explanation of why this exists and what it relates to can be found in this answer: https://retrocomputing.stackexchange.com/a/7266

2
  • 4
    a small explanation of what it does would be nice
    – GoTTimw
    Apr 26, 2019 at 15:31
  • My .bashrc complains about that when I log into my window manager - a modal dialog with an error is displayed (only on Desktop with graphical wm, server ok).
    – orion3
    Aug 8, 2019 at 17:42
17

As others have mentioned, the required fix is adding stty -ixon to your ~/.bashrc file. However, it should be protected from execution by non-interactive shells:

if [[ -t 0 && $- = *i* ]]
then
    stty -ixon
fi 

This should avoid errors when there is no TTY or interactive session in the first place, so "internal" shell invocations of desktop environments etc. will not cause error messages.

5

Adding to telcoM's solution, Arch's default .bashrc has this:

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

It is worth checking if your bashrc already has such checks, therefore avoiding the need for additional ifs.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .