Tag: linux

Take Screenshots in Xfce

ImageMagick must be installed for this to work.

Create a file named screenshot, and paste this into it.

#!/bin/bash
xwd -root | convert xwd:- ~/Desktop/screenshot.png

Run this command to make the file executable.

$ chmod +x screenshot

Run this command to move the file to /usr/bin.

# mv screenshot /usr/bin/screenshot

Open the Xfce menu -> Settings -> Keyboard Settings. Go to the Shortcuts tab, and add a new theme. Now add a shortcut; type screenshot for the command, and press the Print Screen key when it tells you to set the shortcut.

Now when someone posts yet another “show your desktop” thread, you won’t have to feel left out!

Organizing Files by File Type

Edit:

Run this, replacing /current/folder/ with the folder the files are in, .filetype with the file type, and /new/folder with the folder you are moving the files to.

$ mv /current/folder/*.filetype /new/folder

Tip: Don’t reinvent the wheel.

Original:

I have a lot of images, and I wanted to separate all of my .gif’s from the main folder, so this is what I did.

Create a file named organize_files, and paste this into it.

#!/bin/bash
cd $2
for i in *$1; do mv `basename $i $1`$1 $3; done

Make it executable.

$ chmod +x organize_files

Move it to /usr/bin.

# mv organize_files /usr/bin/organize_files

Now, to move your files, make the directory you want to move them to, and run this.

$ organize_files FILETYPE CURRENTFOLDER NEWFOLDER

Example

My pictures are in /home/kevin/pictures and I want my .gif’s in /home/kevin/gifs

$ organize_files .gif /home/kevin/pictures /home/kevin/gifs