如何获取登录屏幕的屏幕截图?

如何获取登录屏幕的屏幕截图?

我不想在虚拟机中重新创建我的Ubuntu安装。

此博客可能会有所帮助: http : //ptspts.blogspot.com/2010/02/how-to-create-screen-shot-of-gdm-login.html

安装ImageMagick进行下面的图像文件格式转换:

sudo apt-get install imagemagick 

创建一个帮助脚本:

 echo 'DISPLAY=:0 XAUTHORITY=/var/lib/gdm/:0.Xauth xwd -root' >/tmp/shot.sh 

确保您的登录屏幕处于活动状态(注销或重新启动计算机,并等到您看到登录屏幕)。 以文本模式登录(按Ctrl-Alt-F1)或使用SSH登录。 通过运行创建屏幕截图

 sudo bash /tmp/shot.sh >/tmp/shot.xwd 

您现在可以登录(首先按Ctrl-AltF7返回GDM登录界面)。 将屏幕截图转换为JPEG和/或PNG:

 convert -quality 50 /tmp/shot.xwd /tmp/shot.jpg convert /tmp/shot.xwd /tmp/shot.png 

在您喜欢的图像查看器中查看屏幕截图。

对于11.10和Lightdm以及之后

您可以尝试在终端中运行unity-greeter --test-mode 。 它显示会话中的登录屏幕。 然后,您可以像通常使用任何其他应用程序一样截取登录屏幕的屏幕截图。

在此处输入图像描述

你可以试试这个:

 gnome-screenshot -d 10 

你不需要安装任何东西只需输入命令并锁定屏幕,屏幕将在执行命令后10秒内拍摄。

在此处输入图像描述

对于Ubuntu 14.04

上面的答案在Ubuntu 14.04中对我不起作用 – 我四处搜索并发现这有效。

  1. 安装ImageMagick

     sudo apt-get install imagemagick 
  2. 在您的主目录中创建名为shot.sh的文件,最好在您的主文件夹中,并在其中粘贴以下代码:

     chvt 7; sleep 5s; DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/:0 xwd -root -out ~/screenshot.xwd; convert ~/screenshot.xwd ~/screenshot.png; rm ~/screenshot.xwd 
  3. 让它可执行

     sudo chmod +x shot.sh 
  4. 退出系统。 按Ctrl + Alt + F1进入控制台(tty1)并登录。 使用以下命令运行脚本:

     sudo ./shot.sh 

它将返回登录屏幕图形界面(chvt 7),五秒后,它将采用文件名screenshot.png将屏幕截图保存在您的主目录中。


这是我的:

在此处输入图像描述

资料来源: http : //itsfoss.com/screenshot-login-screen-ubuntu-linux/

在终端中键入:

 dm-tool add-nested-seat --fullscreen 

而已! 像往常一样截取屏幕截图

按Alt + F4关闭登录屏幕的全屏窗口

只是想注意我在Ubuntu 10.04 LTS上做了一些问题 – 这是我的解决方案:

我在机器A上,我通过ssh登录到机器B:

 myusername@pcA:~$ ssh pcB myusername@pcB's password: Linux pcB 2.6.32-44-generic #98-Ubuntu SMP Mon Sep 24 17:32:45 UTC 2012 i686 GNU/Linux Ubuntu 10.04.4 LTS Welcome to Ubuntu! * Documentation: https://help.ubuntu.com/ myusername@pcB:~$ 

然后,我继续尝试抓取截图,但都失败了。 问题可以减少到xwininfo无法探测窗口状态:

 myusername@pcB:~$ xwininfo xwininfo: unable to open display '' myusername@pcB:~$ sudo xwininfo [sudo] password for myusername: xwininfo: unable to open display '' myusername@pcB:~$ DISPLAY=:0.0 xwininfo No protocol specified xwininfo: unable to open display ':0.0' myusername@pcB:~$ DISPLAY=:0 xwininfo No protocol specified xwininfo: unable to open display ':0' 

好吧,事实certificate,由于某种原因,通过ssh正确调用X-windows的目标是DISPLAY=:0.0 sudo xwininfo ... – 也就是说, DISPLAY=:0.0环境变量首先出现; sudo在第二位 – 然后是相应的X命令:

 myusername@pcB:~$ DISPLAY=:0 sudo xwininfo xwininfo: Please select the window about which you would like information by clicking the mouse in that window. myusername@pcB:~$ DISPLAY=:0.0 sudo xwininfo -root xwininfo: Window id: 0x109 (the root window) (has no name) Absolute upper-left X: 0 Absolute upper-left Y: 0 Relative upper-left X: 0 Relative upper-left Y: 0 Width: 1366 Height: 768 Depth: 24 Visual: 0x21 Visual Class: TrueColor Border width: 0 Class: InputOutput Colormap: 0x20 (installed) Bit Gravity State: ForgetGravity Window Gravity State: NorthWestGravity Backing Store State: NotUseful Save Under State: no Map State: IsViewable Override Redirect State: no Corners: +0+0 -0+0 -0-0 +0-0 -geometry 1366x768+0+0 

既然我们知道xwininfo可以探测状态,那么通过xwd捕获屏幕截图也没有问题:

 myusername@pcB:~$ DISPLAY=:0.0 sudo xwd -root > /tmp/shot.xwd 

我编辑了“/ etc / mdm / Init / Default”并添加了:

scrot -d 5 -e 'mv $f /root' &

在“退出0”行之前。

下次我登录时,我数到五,发出哔哔声,然后我在“/ root”中获得了截图。

无需安装任何东西。 在这里,您有史以来最好的解

 gnome-screensaver-command -l && sleep 2 && gnome-screenshot -c && loginctl unlock-session 

该命令将锁定屏幕,将屏幕截图复制到剪贴板并再次解锁屏幕。

在此处输入图像描述