I have some output in TTY1 that I think might hold clues as to why my last GUI session froze (CtrlAltBackspace was able to get me back to the terminal and I reloaded the GUI).

However, I cannot seem to find a way of copying the text that is on screen, but (I hope) not vanished from a file/device yet. Any suggestions?

  • 1
    Have you looked in /var/log/Xorg.0.log or /var/log/syslog to see if what you need is there? – goldilocks Sep 2 '13 at 12:54
  • Have you looked at this question? – Joseph R. Sep 2 '13 at 17:18
  • @JosephR. - Thanks for the link, but all the answers to this question appear to be about "getting" another TTY's output in the future, not what is on the screen in that TTY already. – user66001 Sep 3 '13 at 1:42
  • @goldilocks - /var/log/Xorg0.log doesn't contain any of the text, in any of the TTY's (But, as an aside, I found evidence that my distro (Parted Magic) did try and make the mouse I had plugged and unplugged a dozen times, available after I initially unplugged it mid-session, but No input driver specified, ignoring this device concluded it's attempt). Also, A) What are the (II) / (--) / (**)? B) How do I translate what seems like a date stamp on the left hand side of each line? As for /var/log/syslog, I don't appear to have a file, in that location, by that name.. – user66001 Oct 3 '13 at 21:22

/dev/tty0 on Linux is the current virtual terminal, while /dev/tty1, /dev/tty2... are the individual virtual terminals.

You can get a dump of the content of each via the /dev/vcs1, /dev/vcs2... devices, or the current one with /dev/vcs (sometimes /dev/vcs0)

# cp /dev/vcs1 some-file
# stty size < /dev/tty1
67 240
# fold -w 240 < some-file | sed 's/ *$//'
X.Org X Server 1.12.4
Release Date: 2012-08-27
X Protocol Version 11, Revision 0
Build Operating System: Linux 3.2.0-4-amd64 x86_64 Debian
Current Operating System: Linux sc 3.10-2-amd64 #1 SMP Debian 3.10.7-1 (2013-08-17) x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-3.10-2-amd64 root=/dev/mapper/linux-debian64 ro quiet
Build Date: 17 April 2013  10:22:47AM
xorg-server 2:1.12.4-6 (Julien Cristau <jcristau@debian.org>)
Current version of pixman: 0.30.2
    Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.1.log", Time: Mon Sep  2 10:19:44 2013
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
resize called 1920 1080
  • That's it! Except, I only have the last ~20 lines, of the ~50 lines visible on the screen currently, and my several hundred long lined output that I have seen scrolling past for the last day or two :( – user66001 Sep 3 '13 at 1:54
  • Note that /dev/vcs1, /dev/vcs2, etc, only contain the current content of the virtual console, i.e. only one screen worth of characters. – sergut Sep 3 '13 at 13:34
  • @StephaneChazelas - Not wanting to seem to doubt sergut's last comment, but is there no way you know of to get the contents of the virtual console that has scrolled off screen? Or (though not really ideal right now) ways of preserving more output in future? – user66001 Sep 6 '13 at 14:40

If you have not done it yet, install gpm.

Then use the mouse to easily select-copy and paste (using mid-button) the text you need into any editor (or cat -> tmpfile.txt).

It is available in most distributions, and also as a tarball and a GitHub repo.

  • gpm won't work if the output is on a TTY with no login; but if that's the case and a login doesn't then clear the screen, it should be doable. – goldilocks Sep 2 '13 at 16:33
  • To address goldilock's comment, I am not sure if I logged into this TTY prior to noticing the "logging" being done to it, though I suspect I didn't. sergut - I haven't... Does gpm have a TAR download (Doesn't appear so from the official website, as the distro that I am currently working with (Parted Magic) has no package manager. Also, does gpm allow select-copy and pasting of any text that has scrolled off screen in any TTY? – user66001 Sep 3 '13 at 1:49
  • 1
    gpm allows you to copy and paste any text currently on screen. If the text has scrolled off the screen you can usually get it back with Shift + PageUp (unless you have switched to another TTY in the meantime, in which case whatever flowed up-and-out of the screen is usually lost). – sergut Sep 3 '13 at 13:36
  • @sergut. Thanks. Does gpm have a non-package-manager download (Doesn't appear so from the official website) as the distro that I am currently working with (Parted Magic) has no package manager – user66001 Sep 5 '13 at 17:41
  • Yes, I added the links to the answer two days ago. ;-) See here: nico.schottelius.org/software/gpm/archives. You have tarballs of the latest versions. – sergut Sep 6 '13 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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