Hacker News new | ask | show | jobs
by rascul 1406 days ago
You can use the script(1) utility (from util-linux) to record a session and it will save the ANSI colors. This only works if you do it ahead of time, though. And if you're putting it in a pastebin, the color codes will get in the way.
2 comments

There's also https://asciinema.org . It makes recordings which can be replayed just like video (colors and all), but weigh almost nothing and let you select and copy text. There are lots of examples on the main page.
There exists tooling to convert these typescripts into, for example, HTML output to include on your website. I use the script(1) util as part of my dayjob to create a bit of a trail when there are questions later.

Some terminal emulators also support dumping the buffer as HTML.

> There exists tooling to convert these typescripts into, for example, HTML output to include on your website.

Indeed, I mentioned aha in another comment.

> Some terminal emulators also support dumping the buffer as HTML.

That's a nifty feature that I haven't run into yet. Seems like it could be quite useful.

Konsole does HTML export and the HTML is simple/editable (only inline styles, insignificant whitespace removed, output as-shown, not as-generated, so e.g. a progress bar is just a single line of text, not however many times it was updated).