CentOS : Is it possible to take screenshot in command line from another tty

0

I am using centOS 7. Let's say I am in tty2 in a terminal. I want to screenshot via a command line what's going on in tty1. Is it possible and if yes how ?

M.Brbr

Posted 2019-11-22T09:32:19.823

Reputation: 129

Is tty1 running Xorg graphics, or is it just a plain text console? – user1686 – 2019-11-22T09:34:42.420

A screenshot is for something that is visible. Is that the case? – harrymc – 2019-11-22T09:39:07.780

on tty1 xvfb helps me display the graphical interface of a program run by a docker container. – M.Brbr – 2019-11-22T13:40:11.440

Answers

1

Graphics mode:

It seems that this is not possible in a generic manner, as the kernel doesn't keep individual framebuffers per virtual console, the compositor (Xorg/Wayland) directly takes over the actual GPU outputs. When you switch away, it's not kept in kernel memory.

In X11, you may get some results by using CLI screenshot tools, e.g. maim – but it seems that they won't work with window managers which use 3D accelerated compositing (such as gnome-shell), because the screen contents are completely unloaded on VT switch.

Text mode:

You can use peekvc to dump another virtual console's contents as ANSI text.

Virtual console contents are directly accessible through /dev/vcs# and /dev/vcsa# files (the former containing just plain text, the latter containing formatting attributes as well).

Note that this isn't a recommended method for live monitoring. If you want the same program to be continuously running on multiple consoles, you should use a terminal multiplexer such as tmux or screen or abduco which lets you "attach" to the same session.

user1686

Posted 2019-11-22T09:32:19.823

Reputation: 283 655