

Tasks: 252 total, 1 running, 251 sleeping, 0 stopped, 0 zombie The head tail strip out those special sequence, let it show content at normal seems the watch command also use this mechanismĪnd then scroll up so I can copy/paste: top Htop.out is not blank, it just show content in alternative screen, no effecit with normal screen. ^[[?1049l: switch to normal screen end of htop.^[[?1049h: switch to alternative screen begin of htop.Will see something like this ( ubuntu18, gnome-terminal, TERM=xterm ) ^[[?1049h^[[22. just use head & tail strip the screen reset console_sequence show output in terminal head -c -10 /tmp/htop.out | tail -c +10 htop.out has terminal save/load console_sequence 2. save terminal output to file echo | htop > /tmp/htop.out


This can get colorful output same as you see when htop running. Here's what the first few lines look like: 1 Tasks: 73, 251 thr 1 runningĢ Load average: 0.28 0.32 0.32 Briefly, install aha from the software center and then run: echo q | htop | aha -black -line-fix > htop.html However, a little further down on the same page, there's a solution which uses ANSI to HTML conversion. Ron provided a link to htop output to human readable file and a quote from the top-voted answer by the developer of htop.
