X11 screen grabber from cmd line

Matthew Seaman matthew at freebsd.org
Fri May 10 07:23:57 UTC 2013


On 10/05/2013 07:09, Polytropon wrote:
> On Thu, 9 May 2013 20:41:45 +0200, Matthias Apitz wrote:
>> Do we have something in the ports which could do a screen shoot of $DISPLAY, but
>> from the cmd line of an alpha console, and save it as PNG or JPEG?
> 
> 	% xwd -out screen.xwd
> 	% convert screen.xwd screen.png
> 		-or-
> 	% convert screen.xwd screen.jpg
> 
> But if you've got installed ImageMagic (the "convert" command)
> anyway, you can also use
> 
> 	% import screen.jpg
> 		-or-
> 	% import screen.png
> 
> For a whole screen capture, "xwd -root" or "import -screen" can
> be used.

You're somewhat missing the point here, I'm afraid.  There are many
alternatives for grabbing screen shots from *within* an X session
itself.  What the OP wants is a way to grab a screenshot of an X session
from a different, non-graphical terminal.

Now, if you know the $DISPLAY setting for the screen in question, and
you can wrangle xauth(1) into letting you have access to that display,
then you should be able to run any of the suggested programs from any
separate command line interface on the system.

The xauth(1) man page is reasonably clear, and if you're logged into the
same Unix accout as the user running the display, it might just work
only by setting $DISPLAY appropriately in your environment.

Note that allowing other users to access your X session like this means
they can snoop on anything you do in that session, including recording
any passwords you type and so forth.  Don't give out such access except
to people you trust.

	Cheers,

	Matthew




More information about the freebsd-questions mailing list