Linux For Cynics One user's experiences with Linux

29Jan/140

bro pages: an improvement on man pages

bro pages are a highly readable supplement to man pages.
bro pages show concise, common-case examples for Unix commands.

2Aug/130

Reset or Change Terminal Background

Sometimes if you use vim in a virtual terminal with a color scheme with more than a 256 color pallet, you will have some ugly results:
debian-2013-08-02 14_46_17-
Even worse, those ugly colors may stick around after vim has exited. This is because a virtual terminal is essentially a state machine. When something changes, it has to be explicitly changed back to reverse it:
debian-2013-08-02 14_48_40-

One way to do this is to use the

tput

command. To go back to the normal colors, simply use this command:

$ tput reset
22Mar/130

Create Screenshots from Terminal Emulator

Probably the simplest way to create screenshots is using the commands

xwd

which dumps an image of an X window and

convert

which is a member of the ImageMagick suite of tools. It can be used for much more than converting image formats, but that's what we'll be using it for this time.

Screenshot of Whole Screen

So, to take a screenshot of your whole screen and call it capture.png, run this:

$ xwd -root | convert - capture.png

Add a Delay

Let's say you want to add a delay before the screenshot is taken (say, to move the terminal window out of the way), then simply add a sleep command before the others. For example:

$ sleep 3; xwd -root | convert - capture.png

adds a three second delay before the x window is dumped, and converted to a png.

Screenshot of Single Window

The "-root" argument to xwd tells it to capture the entire X window tree, the whole screen. If you leave it off, you will be given a cursor to click the window you want to capture.

So, if you just want to take a screenshot of a single window, then just run:

$ xwd | convert - capture.png

And click on the window you want.

Note:
I say "terminal emulator" because the xwd command relies on X to be running. This would not work on a login without X running.