What is "flush" (^o)?

C

CrazedNerd

Guest
I'm currently reading "learning the bash shell, 3rd edition", and the author is mentioning that a lot of the control keys do the same thing as some of the other keys: for example, control-m (^m) is the same thing as pressing "enter". I see one labeled "flush", which is the same thing as control-o on linux at least. What exactly is flush? My google results aren't coming up with anything that seems relevant.
 


Try:
Code:
stty -a
where on my debian system, ^o is now called "discard". In the olden days I recall it was called "flush". The meaning was that it would flush the console screen. Essentially that means that it sends the output on the screen to /dev/null ... to the "bit bucket". It was used in my experience on the console when text, for some reason, became gibberish and full of unreadable symbols, something like this:
Code:
�u��D �Cu��D Y
             Du��D ($D u���A�F�J�~
AA
  PD�u��D 4hD�u��?B�E�E �D(�J0I(Q BB8�D�u���B�B�A �D(�J0R
(A ABE
      �v��D��D
              v��4
                  Ev��CB�E�E �A(�G0d(D BBDE0v��2A�`ETv��mD(xE�v���A�E�J |
AB

Usually the screen would produce this when the symbols in a binary file triggered one or more of the codes which the terminal was based on, tripping it into this unreadable output. In order to get the screen back into text readable mode, the screen had to be flushed with the ^o command as part of a sequence of commands. This still works on the consoles of today, that is the consoles accessed though the Function keys: Cntl+Alt+F2 etc. One particular sequence of commands that restores the screen is
Code:
cat
<enter>
^o
<enter>
^d
Cntl+d in this sequence is the "end of file" key combination which can be seen in the output of "stty -a". It closes things off, such as terminals when you run it within them.

On modern xterminals, this sequence may not work at transferring the screen symbols back into text. For example, with the "xterm" terminal, all you need to do is to run the command: reset, to return to text from the symbols.

If you want to play with this, you can try and transform a terminal with gibberish by catting a binary file to see if it does it, so that you can then use the commands to regain the text output. Normally I haven't intentionally tried to get the gibberish on screen but one example I came across recently was to run:
Code:
cat /sbin/*
It runs for some time and can be stopped with ^C at any point. It might take a little time though to mess the screen up. When stopped and showing the gibberish, the above command suggestions for both consoles and xterms should help return it to text. If they don't, the terminal itself can simply be killed with no further ado. Deep info on terminals is in the Text-Terminal-HOWTO from the tldp project.
 
Last edited:
Try:
Code:
stty -a
where on my debian system, ^o is now called "discard". In the olden days I recall it was called "flush". The meaning was that it would flush the console screen. Essentially that means that it sends the output on the screen to /dev/null ... to the "bit bucket". It was used in my experience on the console when text, for some reason, became gibberish and full of unreadable symbols, something like this:
Code:
�u��D �Cu��D Y
             Du��D ($D u���A�F�J�~
AA
  PD�u��D 4hD�u��?B�E�E �D(�J0I(Q BB8�D�u���B�B�A �D(�J0R
(A ABE
      �v��D��D
              v��4
                  Ev��CB�E�E �A(�G0d(D BBDE0v��2A�`ETv��mD(xE�v���A�E�J |
AB

Usually the screen would produce this when the symbols in a binary file triggered one or more of the codes which the terminal was based on, tripping it into this unreadable output. In order to get the screen back into text readable mode, the screen had to be flushed with the ^o command as part of a sequence of commands. This still works on the consoles of today, that is the consoles accessed though the Function keys: Cntl+Alt+F2 etc. One particular sequence of commands that restores the screen is
Code:
cat
<enter>
^o
<enter>
^d
Cntl+d in this sequence is the "end of file" key combination which can be seen in the output of "stty -a". It closes things off, such as terminals when you run it within them.

On modern xterminals, this sequence may not work at transferring the screen symbols back into text. For example, with the "xterm" terminal, all you need to do is to run the command: reset, to return to text from the symbols.

If you want to play with this, you can try and transform a terminal with gibberish by catting a binary file to see if it does it, so that you can then use the commands to regain the text output. Normally I haven't intentionally tried to get the gibberish on screen but one example I came across recently was to run:
Code:
cat /sbin/*
It runs for some time and can be stopped with ^C at any point. It might take a little time though to mess the screen up. When stopped and showing the gibberish, the above command suggestions for both consoles and xterms should help return it to text. If they don't, the terminal itself can simply be killed with no further ado. Deep info on terminals is in the Text-Terminal-HOWTO from the tdlp project.
typically you get that wierd text when you're reading/outputting a binary file, it's just better not to read those, but "stty -a" does show the control codes thanks
 

Members online


Top