Skip to content

Easy screenshots with the keyboard in Linux

There was an article today at Linux.com that reviews various screenshot programs available for Linux. What it doesn’t tell you, is how to take screenshots painlessly in Linux. Let me try and do that. Since I use a Mac, I’m quite used to the Mac OS X way – Command+Shift+3 takes a full screenshots and leaves a PNG file on your desktop, and Command+Shift+4 allows you to select a region for a screenshot.

Duplicating that in Linux is quite simple. First, you need scrot, a command-line program mentioned in the article linked above. Fedora users can get it through yum (yum install scrot). Otherwise you’ll need to download and compile it.

Next, we need to setup the keyboard shortcuts. I’ll describe this for KDE, but I’m sure there’s an equivalent way to do this in GNOME. In KDE (3.5) go to Control Center -> Regional & Accessibility -> Input actions. Create a new action of type “Keyboard Shortcut -> Command/URL (simple)”. I setup Ctrl+Shift+3 to the command scrot ~/Desktop/scr`date +%d%b%y_%H%M%S`.png and Ctrl+Shift+4 to the command scrot -s ~/Desktop/scr`date +%d%b%y_%H%M%S`.png. See the screenshot below (click for larger image).


Screenshots in KDE

Now, pressing Ctrl+Shift+3 puts a full screenshot on your desktop, and pressing Ctrl+Shift+4 allows you to either select a window (single click in a window) or select a region of the screen (click and drag rectangle) and the appropriate capture will be placed on the desktop. The files are dated and timed, so they should be easy to find.

4 Comments