commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for:
Now try this. Ones you see small cross arrow, double click on any window you like to make a screenshot "selectively".
Works with *rooted* Android devices. 400x800 are the screen dimensions of a typical handheld smartphone.
Requires you to have password free login to remote host ;)
Requires xclip and notify-send (If you want to put into clipboard and be notified when action is completed).
DATE=$(date +%Y-%m-%d_%H-%M-%S)-$(($(date +%N)/10000000));
HOST="ssh host of your choice";
DEST="destination folder without trailing slash";
URL="URL for file if uploaded to web enabled dir ie.
import -window root png:- | ssh $HOST "cat > $DEST/screenshot_$DATE.png";
echo $URL | xclip; notify-send -u low "Screenshot Taken" "Entire screen.\nCopied to clipboard"
scrot, curl, egrep, sed, xsel, libnotify-bin must be installed.
P.S. Sorry for so long command
In general, this is actually not better than the "scrot -d4" command I'm listing it as an alternative to, so please don't vote it down for that. I'm adding this command because xwd (X window dumper) comes with X11, so it is already installed on your machine, whereas scrot probably is not. I've found xwd handy on boxen that I don't want to (or am not allowed to) install packages on.
NOTE: The dd junk for renaming the file is completely optional. I just did that for fun and because it's interesting that xwd embeds the window title in its metadata. I probably should have just parsed the output from file(1) instead of cutting it out with dd(1), but this was more fun and less error prone.
NOTE2: Many programs don't know what to do with an xwd format image file. You can convert it to something normal using NetPBM's xwdtopnm(1) or ImageMagick's convert(1). For example, this would work: "xwd | convert fd:0 foo.jpg". Of course, if you have ImageMagick already installed, you'd probably use import(1) instead of xwd.
NOTE3: Xwd files can be viewed using the X Window UnDumper: "xwud <foo.xwd". ImageMagick and The GIMP can also read .xwd files. Strangely, eog(1) cannot.
NOTE4: The sleep is not strictly necessary, I put it in there so that one has time to raise the window above any others before clicking on it.
Take a screenshot of the focused window with a 4 second countdown
# shorten by adding to your .bashrc: alias sss='scrot -ucd4 && eog $(ls -tr | tail -n1)'
echo -e "\nalias sss='scrot -ucd4 && eog $(ls -tr | tail -n1)'" >> ~/.bashrc
-d 4 second delay
-c display countdown
-u focused window
man scrot for more flags
when using Gnome or KDE, you will have a hard time getting a screenshot of something like a login screen, or any other screen that occurs before the desktop environment is up and monitoring the printscreen key. (this probably applies for other DEs as well, but I haven't used them)
What this command is meant to do is take a screenshot of an X window using a command you can run from your virtual terminals (actual text terminals, not just an emulator) To do this:
Press CTRL+ALT+F1 to go to a virtual (text) terminal once your login window comes up
Login to the virtual terminal and enter the command (you'll have to type it in)
You should now have a file called screenshot.png in your home directory with your screenshot in it.
For those of you who are new to the virtual terminal thing, you can use CTRL+ALT+F7 to get back to your regular GUI
The `export` is unnecessary if it's only applicable to the one command.
Like the given command, but combines _DISPLAY=":0.0"_ with _export DISPLAY_ to get _export DISPLAY=":0.0"_ and only imports if DISPLAY is set successfully.