Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm running OpenSuse with dwm as a window manager. Since I made the switch from KDE, I haven't found a way to take a screenshot or even capture part of my screen.

Is there a way I can do this in a command-line environment?

share|improve this question
add comment

4 Answers

up vote 9 down vote accepted

The euphoniously named scrot takes screenshots from the command line...

It has a couple of simple options, including a time delay and image quality.

If you are wanting to take a shot in the console, and you are running a framebuffer, then you can use fbgrab.

share|improve this answer
    
scrot is genius. many thanks for this tips (even though "crotte" means "shit" in french) –  Olivier Pons Nov 21 '11 at 10:56
    
I had problems with fbgrab. I can attest that my frame buffer is 1366x768 but both fbgrab and fbshot think /dev/fb0 is 1024x768, which scales the console fonts and makes me sad. When I give fbgrab the width and height it says there is not enough data. –  BentFX Nov 21 '11 at 11:18
    
@BentFX are you sure that the actual framebuffer resolution is 1366x768, or is it just your screen (panel) native resolution? What does cat /sys/class/graphics/fb0/{modes,virtual_size} give? Also, if you do a 1024x768 dump, is the image cropped? –  rozcietrzewiacz Nov 21 '11 at 11:58
    
Ok, I can attest to the fact that I'm often caught speaking out of my class. Yes it is 1024x768, but my X screen is 1366 and that's part of what made the fbgrab output look so bad. 1366 is the native width and it is sharp. 1024x768 is fuzzy. From the console it looks nicely antialiased, but a picture of it is just ugly. :) I stand corrected! –  BentFX Nov 21 '11 at 13:42
add comment

ImageMagick comes with the import utility to take screenshots. It has tons of options, but by default it lets you draw a rectangle on the screen and saves just that portion. If you want an entire window you can use -window ID; the identifier "root" captures the entire screen

share|improve this answer
add comment

I have been using Shutter under Xmonad without any desktop environment and it has been working well. Shutter is a GUI app with a decent amount of features.

Most of the time I would type "shutter -s" in a launcher/terminal and the program will let me choose the area of the screen that I want to capture. Then I hit Enter and the file will be saved to my home folder.

share|improve this answer
add comment

If you are looking for minimalistic solutions, your Xorg server might already comes with a tool called xwd. If not, and you'd install it separately, it might be the lightest possibility - the binary is just 27 KB in size. Watch out, because it outputs data on stdout!

But the problem with xwd is that it dumps the screenshot in an XWD X Window Dump image data format, not a standard image. You can view such dumps with a companion xwud program (run xwud -in yourdumpfile). To get a typical image file, you'd need to convert it using something like xwdtopnm or convert (from ImageMagick).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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