Some Productive Ubuntu Kung Fu

Editor: Say hey to Keir Thomas, author of the new book Ubuntu Kung Fu, who stopped by to share some of his best material from the book. Thomas writes:

Here are a few of my favourite pointers to increase productivity if you're an Ubuntu user. None of the tips are specific to Ubuntu, and with a little wrangling should work on any GNOME-based Linux desktop. All are taken from my new book Ubuntu Kung Fu, which contains over 300 other tips on the topic of productivity, security, performance, image editing, the command-line, hardware, and much more.

1. Instantly Search Google for Any Word or Phrase

Have you ever been reading a document and wanted to look up something in Google? In Firefox you can just highlight the word or phrase, right-click it, and select Search Google. However, what if you're reading, say, a PDF file? Or a man page in a terminal window?

A very simple but effective solution is Googlizer, which you can install using Synaptic. Once installed, it's added to the Applications —-> Internet menu, so you'll have to manually drag and drop it to a blank spot on the panel for quicker access.

How it works is simple. Highlight any text, in any application, and then click Googlizer's icon to instantly search Google. If a Firefox window is open, a new tab will be added showing the search results. Otherwise, Firefox will be started, and the search results will be shown. Try it. It's one of those simple things that might just change the way you work forever.

Googlizer can be personalised so that it searches the version of Google localised to your country or even a non-Google search engine. To do this, you'll need to discover the search URL for the engine you want to use. To do so, just perform a search using either the localised version of Google (for example,, if you live in Australia) or a different search engine. Then look at the URL for the part where your search term appears, and highlight/copy all that comes before it.

For example, if I search for Ubuntu Kung Fu using, I get the following URL for the search results page: I chop the end off, from the Ubuntu+Kung+Fu part onward, and I'm left with the following, which I copy into the clipboard (highlight the text, and hit Ctrl+c):

Once you have the information, right-click the Googlizer panel icon, and select Properties. In the Command line, add —url after googlizer, and then paste your Google URL. For example, I ended up with the following, as shown in the screenshot (note that I resized the dialog box for the purposes of the figure):

googlizer --url

You can also change the icon if you want by clicking the icon preview at the top left of the dialog box.

When finished, click the Close button, and then test the new localised search.

Here are some URLs that will make Googlizer use other search engines—-just add these addresses after the —url part of the Command line, as described earlier:
Microsoft Live:

2. Turn Your Desktop into Your /home Folder

Do you use your desktop as a dumping ground for files and pretty much ignore your actual /home folder, which is where you should store things? If so, you might be interested in this tweak, which effectively makes Ubuntu use your /home folder for the desktop, instead of the actual /home/username/Desktop folder. Anything saved to the desktop, such as files/folders dropped there, will be placed in your /home folder. Additionally, anything in your /home folder will appear on the desktop.

To try this, hit Alt+F2 and type gconf-editor. In the program window that appears, navigate to /apps/nautilus/preferences in the list on the left, and
put a check alongside desktop_is_home_dir on the right of the program window. Then log out and back in again.

Remember that the old contents of your desktop haven't vanished. They're still in the Desktop folder in your /home folder.

3. Scroll Without the Mouse in Firefox and Evolution Mail Windows

Both Firefox and Evolution have a hidden caret browsing feature. This is where a cursor appears in a web page or received email, just like in a word processing document. Just like in a word processor, its position can be controlled using the cursor keys. When the cursor reaches the bottom or top of the screen, the page (or email) scrolls.

Caret browsing was designed as an accessibility feature for those who find reading difficult, but it's proved popular for every kind of user. This is because it allows people to navigate web pages or emails without taking their hands off the keyboard (there's no need to reach for the mouse scroll wheel, for example) and also keep track of where they were last reading should they walk away from their computer. In addition to navigation, text can be highlighted in the usual way by holding down Shift and using the cursor keys. It can then be copied in the usual way by pressing Ctrl+c.

To activate caret browsing in either application, just hit F7 while the program is running. The cursor will appear at the top of the web page or email preview window, although it can be repositioned by clicking the mouse anywhere.

4. Quickly Create Links to files, Folders, and/or Applications

There is a curious feature missing from the Ubuntu desktop: quick and easy shortcut creation. For example, suppose you want to create a desktop shortcut to your Documents folder. You can right-click it and select Make Link, but this won't work with all folders because the new link is created within the parent folder, and you might not have permissions to write there (this can be an issue when creating links to system programs in the /usr/bin folder, for example). You can create a desktop launcher that redirects to the folder or file, but this is annoyingly long-winded and involves working your way through a dialog box.

A solution to this problem is built into GNOME. It's just hidden. Simply middle-click the folder or file, drag it to where you want the shortcut to be, and then select Link Here from the menu that appears when you release the mouse button. This will create a new link to the folder or file. On most modern mice, the middle mouse button is the scroll wheel, which doubles as a third mouse button.

The type of link created is a symbolic link, which isn't just a GNOME desktop shortcut. It will also work at the command line too.

To create a symbolic link at the command line, type ln -s, specifying the original file and then the new link name (including paths, if necessary). For example, the following will create a link to the Gedit text editor (which lives in the /usr/bin folder) on the desktop and call it Text Editor; this command assumes you're currently browsing your /home folder:

ln -s /usr/bin/gedit "Desktop/Text Editor"

After this, the link will act just like the original file—double-clicking it will start Gedit. It's worth pointing out for the nervously inclined that deleting the shortcut won't delete the original file.

5. Intelligently Select Only the files You Want

Imagine the following: you're working on a project and have been saving the files in your Documents folder, which is where all your files tend to end up, regardless of project. This particular project involves pictures (of varying file types), word processing documents, and spreadsheets... You spend a few minutes considering how chaotic it all is, and then your boss asks you to send all the project files to him. However, there are hundreds, and you can't sort by file extension or alphanumerically, because they're all different.

Assuming all the files contained the project name, you could use Nautilus's Select Pattern function, which is found on the Edit menu. For example, assuming the project is called Falken and this word appears somewhere within the project files' filenames, you could type the following into the Select Pattern dialog box:


This uses wildcards, in the form of asterisks, to indicate characters within the filename that could equate to anything. So, the files could start with any text, could end with anything, and could have any file extension, but if it contains the word falken somewhere within it, it will be selected, as if you'd just clicked it. Assuming several files match the pattern, they will all be selected, and you can then click and drag them to the email you're about to send to your boss. Note that the pattern selection tool is case sensitive.

6. Rename Many files at Once (aka Bulk Rename)

Have you ever been out with your digital camera and then returned home to find yourself with lots of files with names like IMG_0159.jpg, IMG_0160.jpg, IMG_0161.jpg, and so on? And have you then gone through one by one renaming them to something relevant? Well, there's no need to ever do that again because Ubuntu can come to the rescue!

There are a handful of ways of bulk renaming files using the command line, but many are quite involved, and you'll need to remember a chain of commands. To save the effort, use Synaptic to install purrr (that's pu, followed by three r's!). This is a GUI application that allows simple bulk renaming. Once installed, you'll find the program on the Applications —-> Accessories menu.

1. Start by clicking and dragging the files from a Nautilus window onto the files section of Purrr. If you intend to bulk rename the files with sequentially increasing numbers, it's important to first sort them into the right order before dragging across——possibly the best way of doing this is to click View —-> View as List in Nautilus and then click the Date Modified heading to sort by the time the files were created (this is ideal for digital photographs). Alternatively, you might click the Name heading if the filenames can be sorted alphanumerically. Then Shift-click to highlight many files at once and drag them into the Purrr window.

2. In the Name template text field, you need to type the basic format of the new filenames. For example, if the pictures were all taken at Disneyland, you might type that. You'll see the effect on the new filenames as you type, although they won't actually be renamed until you hit the Rename button.

3. There are a handful of useful special inserts you can make into the filename. Typing [N]causes the original filename to be added to the renamed files, while [C]adds a sequential number count. [E]causes the file extension to appear (necessary if [N]isn't used).

Here's an example. The following, when typed into the Name template box, will cause all the files to be named Disneyland, followed by a sequentially increasing number, and then followed by the original file extension:

Disneyland [C] .[E]

Try it to see what happens. The [C](count) operator can be further configured. A single comma inserted after C, followed by a number, sets the start number for the count. For example, [C,400]will start the count at 400. For an example from my test PC, see the screenshot. Two commas causes the count to skip numbers as it counts upward. For example, [C,,4]will name the first file with 1, the second with 5, the third with 9, the fourth with 13, and so on. In other words, +4 each time.

Three commas causes the count to be "padded" with zeros, and the number of zeros is specified by the number that follows. [C,,,3]will cause the count to start at 001, then 002, then 003, and so on. When the count reaches double or triple figures, the padding zeroes will disappear (that is, Disneyland_009.jpg, disneyland_010.jpg...disneyland_099.jpg, disneyland_100.jpg, and so on).

4. Once you've typed your selection, hit the Rename button to carry out the renaming.

7. Instantly Create an HTML Slideshow of Photos

Use Synaptic to install igal. Once installed, copy all the pictures you want to make into a slideshow into one folder. Then switch to that folder in a terminal window, and type igal. It's as simple as that——there's no need to specify the files. The necessary HTML files for a slideshow will be created automatically, and all you need do is upload all the files to your website. The main file igal creates is index.html, and you might want to rename this to something like slideshow.html to avoid overwriting your website's index.html file. You should also be aware that igal creates thumbnails of the images as hidden files (files preceded by a period), and these will need to be uploaded to the website too. To view then in a Nautilus file-browsing window, click View —-> Show Hidden files.

There's no reason why the slideshow will work only online. You could also email the whole folder full of images plus HTML to others as a single compressed file and instruct them to double-click index.html when they've decompressed the folder. The slideshow will then open in their browser.

8. Post Blog Entries from your Ubuntu Desktop

Use Synaptic to search for and install gnome-blog. Once installed, right-click a blank spot on the panel, and select Add to panel. Then select Blog Entry Poster from the list.

The program is designed to work with blogs hosted at, Advogato, or LiveJournal. Alternatively, you can configure the software to work with MovableType, Pyblosxon, or WordPress installations on your own web site.

When it runs for the first time, the program will ask you to set up your blog details. You'll need to set the blog type in the Blog Type drop-down list and then set your user name and password (if you're attempting to access blog software you've manually installed on a website, you'll also need to provide the URL). Then click the Lookup Blogs button both to confirm the details are correct and to retrieve the list of blogs that you can use the applet to contribute to. Once the lookup has completed, select its entry from the Blog Name drop-down list. Note that you can contribute to only one blog using the applet.

To make a new posting, just click the applet's button on the panel. Type the title, as prompted, and then the body of the posting into the window. Then click the Post Entry button. Pictures can be dragged and dropped onto the posting window for inclusion too.

9. Quickly Hide/Unhide Windows Using the Keyboard

Ubuntu can "roll up" windows to just their title bars (known as shading), but the function isn't activated by default. However, the function can be coupled to a keyboard shortcut so that you can quickly roll up a window to see what's behind it, before unrolling it again (for example, if you're typing something you've seen on a Firefox web page into a terminal window).

To set this up, sta rt Keyboard Shortcuts (System —-> Preferences), and scroll down to the Toggle Shaded State entry in the list. You'll need to use a keyboard shortcut not already in use and also one that you won't accidentally press. I find Ctrl+Alt+Space works pretty well, so click in the shortcut column alongside the entry in the list, and then hit the shortcut combination (that is, hit Ctrl+Alt+Space—-don't type the words!). Then give it a try on the Keyboard Shortcuts window—roll it up, and then roll it down! If you want to get rid of the shortcut, repeat the previous step to create a new shortcut combination for the entry, and hit Backspace (not Delete!).

10. Get a nice trash can on the desktop

By default, Ubuntu keeps the desktop clean. I think that if your desktop isn't cluttered with icons, then you're not human (and may possibly be a robot). To add the usual Trash, Computer, Network Servers, and other icons to the desktop, start gconf-editor (hit Alt+F2 and type gconf-editor), and head to the /apps/nautilus/desktop entry in the list on the left of the program window. Then, on the right side, put a check alongside trash_icon_visible, home_icon_visible, and so on. The new desktop icons should appear immediately.

The paperback version of Ubuntu Kung Fu is available from all good bookshops, or you can buy the PDF version for just $22.


    I am loving ubuntu and these Kung-fu tips are great. All I need to do now is learn the dark art of simple multiple monitor configuration *sigh*

    Some very nice tips, thanks.

    I've bought the book but haven't read it yet :(

Join the discussion!