2015-09-23

ncurses output to file

Suppose you'd like to store the output of htop to a file. You can do it by taking a screenshot of a GNU Screen session:

$ screen  -d -m -S screenshot htop
$ sleep 1
$ screen -p 0 -S screenshot -X output
$ screen -p 0 -S screenshot -X quit

Now the screenshot lives in output.0 in the current directory.

Adapted from this post on Stack Overflow.