There is a simple way to dump the contents of a virtual console to a file, the screendump command is the best way to achieve this.
ubuntu ~ $ sudo screendump
Ubunt * Stopping System V runlevel compatibility [ OK ] u 14.0 * Starting execute cloud user/final scripts [ OK ]4 .4 LTS ip-172-18-31-5 tty1 ip-172-18-31-5 login: |
The above is an example of dumping the text on a virtual console to the screen.
To select which virtual console to dump from, execute it like this.
ubuntu ~ $ sudo screendump 3 Ubuntu 14.04.4 LTS ip-172-31-20-16 tty3 ip-172-18-31-5 login: |
Another example, using this on Debian 9.
/dev/sda1: clean, 163053/30146560 files, 4392415/120555520 blocks [ 10.948948] usb 1-1.1: firmware: failed to load ar3k/AthrBT_0x01020200.dfu (-2) [ 10.948987] Bluetooth: Loading patch file failed [ 20.959244] r8169 0000:01:00.0: firmware: failed to load rtl_nic/rtl8105e-1.fw (-2) Debian GNU/Linux 9 debian tty1 debian login: jason Password: Last login: Thu Jan 4 09:11:48 AEDT 2018 from 192.168.1.2 on pts/1 Linux debian 4.9.0-4-amd64 #1 SMP Debian 4.9.65-3+deb9u1 (2017-12-23) x86_64 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. _ _ _ _ _ | |__ ___ (_|_|_) |_ __ _ | '_ / _ | | | | __/ _` | | |_) | __/| | | | || (_| | |_.__/ ___|/ |_|_|____,_| |__/ Welcome jason. jason@debian:~$ |
Very useful tip for saving output of a program on a virtual console that you do not want to lose.