Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I like to use the 'script' command to record console sessions. The problem is that the 'typescript' file which is created contains control chars (when using arrows or the delete key).

Apart from editing the file manually, is there a way to generate a file which contains what we see in the file when we cat or more it?

Any attempt with cat, more, less -R, tr, pr ends with a file that displays well, but still contains the control chars.

share|improve this question
up vote 2 down vote accepted

See "script-declutter" at

share|improve this answer

Try with:

less -r typescript

From man less:

-r or --raw-control-chars
       Causes "raw" control characters to be displayed.  The default is
       to  display  control  characters  using  the caret notation; for
       example, a control-A (octal 001) is displayed as "^A".  Warning:
       when the -r option is used, less cannot keep track of the actual
       appearance of the screen (since this depends on how  the  screen
       responds to each type of control character).  Thus, various dis‐
       play problems may result, such as long lines being split in  the
       wrong place.
share|improve this answer
Sorry, I don't want to display the file, but generate another cleaned file. Redirecting with > doesn't work either with less -r (or more or cat). – Gra Sep 22 '10 at 14:45
If you use cat with the same terminal it will interpret the control chars; I can't find anything better than select-copy-paste right now. – cYrus Sep 23 '10 at 14:15

I posted my solution, which basically automates running scriptreplay in screen and dumping the scrollbackbuffer here:
It shows only what was send and received on terminal, not the editing.

share|improve this answer
Please quote the essential parts of the answer from the reference link(s), as the answer can become invalid if the linked page(s) change. – DavidPostill Jan 22 '15 at 13:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.