home.


Tagged: unix


Linux: How to take screenshots and screen grabs from the command line

If you have gnome-screenshot installed, you can type gnome-screenshot -a which will screenshot an area of the window you chose.

The parameters -w copies the whole window. Without parameters and it will copy the entire window.

It will be saved into your Pictures directory as Screenshot.... If you use the -c command it’s suppose to copy to the clipboard, but there’s a bug that prevents this apparently.

If you use the -i command, you’ll see a dialog with capture options.

And after the capture, you will see a save box. With this method you will be able to copy to the clipboard with the button provided.

Ensure you’re on the window you want to capture, if you use multiple desktops.

unix

Bash command line movement and deletion shortcuts

If you have typed in

Man I was mean, but I'm changing my scene

And then press alt shift b (the shift may not be needed) twice the cursor will go back to the m of my.

(alt shift f moves in the opposite direction, incidentally)

Press alt shift d it will delete the word my. Press it again and it will then delete scene.

Press ctl d and you will delete not the word but a single character under the cursor.

Press ctl k and you will delete everything after the position. ctl u everything before.

Press ctl _ and you will undo your command line edits.

unix bash

Linux: Use TLP to save three hours of laptop battery

Install Linux Advanced Power Management:

add-apt-repository ppa:linrunner/tlp
apt-get update
apt-get install tlp tlp-rdw
tlp start

That should save your about two or three hours.

Disabling your touch screen is done via xinput. I disabled my touchscreen and touchscreen pen whatever that is.

Issue xinput -list and then xinput disable 100, where 100 is the the ID you found in xinput. That saves very little normally, but may be worth a go.

unix

Bulk renaming files in Android Asset Studio download

If you use Roman Nurik’s wonderful Android Asset Studio, you’ll get a downloaded zip of differently sized icons.

You may want to rename these files from ic_launcher.png to something else - otherwise it may clash with an existing file of that name.

You can use xargs to do this. Move to the directory of the downloaded file, in the res directory and run this:

ls | xargs -I {} mv {}ic_launcher.png {}YOUR_NEW_FILENAME.png

We list each mipmap-xxxx directory, and rename all the ic_launcher.png files within to our new filename.

android unix-xargs

Unix: Urlencode and urldecode from the command line with Perl

If you want to urlencode or urldecode from the command line–that is escape or unescape URL content–the simplest solution is to use Perl:

perl -MURI::Escape -e 'print uri_escape("&");'

Use the same command, but with url_unescape to reverse the process.

unix urlencode

Page 1 of 12
Next