Here are ten things that you (probably) didn’t know you could do in Ubuntu. All are taken from Ubuntu Kung Fu, my new book.
Create website links that automatically install software
Sometimes if you’re trying to help somebody fix a problem, you’ll have to tell them how to install software. Yet for some Ubuntu newbies, even this can be confusing. The solution is to create a “software install” hyperlink within a web page (such as a forum posting), new email window, or Pidgin message window. To do this, simply click the “create link” button on the web page or within the email (the precise name of this will vary depending on the software/website used), and then type apt:packagename in the URL field, replacing packagename with the precise name of the package as listed in Synaptic.
For example, let’s say you want to tell somebody how to install the thunar package, a lightweight file manager. If you’re creating an email with the instructions, ensure the new mail uses HTML (ensure HTML is checked on the Format menu), and then click Insert –> Link. In the URL field, delete what’s there, and type apt:thunar. Don’t worry about the Description field—leave it with the default contents that will probably mirror what’s in the URL field. Then click the Close button. Note that there’s a slight bug in Evolution that means, for some reason, the hyperlink won’t actually appear as a link until you type some more into the new mail window, or click the Send button.
Perhaps it goes without saying that should you ever receive such a link in an email, or see one on a website, you should be very wary (especially if there are also additional instructions telling you to add a new software repository). It would be easy to disguise a malicious link as something seemingly benign, although you will always be prompted to confirm the choice of software before installation.
Do stuff without touching the mouse
If you want to run an application, just hit Alt + F2 and then type the name of the program. If it needs to run with root privileges, just type gksu beforehand. For example, to run GNOME Terminal, you would type terminal. To run Gedit, type gedit. If the program is command line, check the Run In Terminal box (use the Tab key to move from field to field in the dialog box and hit the Space to select a field). This will then open a terminal window and run the command, but be aware that the terminal window will then close as soon as the command has finished, so you won’t be able to inspect the output. Want to browse to a file system location, but too lazy to grab the mouse and click the Places menu? Hit the forward slash (/), and then type the path into the dialog box that appears. Want to rename a file but don’t want to use the mouse? Just ensure the file is highlighted (use the cursor keys to highlight it if necessary) and hit F2. Then type the new filename. To change the file extension too (which isn’t highlighted for deletion by default), just hit Ctrl + a and then type the complete new filename.
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 shown. Give it a try. It’s one of those simple things that might just change the way you work forever. Googlizer can be personalized so that it searches the version of Google localized 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 localized version of Google (for example, http://www.google.co.uk, if you live in the UK) 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. If I search for Ubuntu Kung Fu using http://www.google.co.uk, I get the following URL for the search results page:
http://www.google.co.uk/search?hl=en&q=Ubuntu+Kung+Fu&btnG=Google+Search&meta=
…so I chop the end off, from the Ubuntu+Kung+Fu part onward, and I’m left with following, which I copy into the clipboard (highlight the text, and hit Ctrl + c ):
http://www.google.co.uk/search?hl=en&q=
Once you have the information, right-click the Googlizer panel icon, and select Properties. In the Command text field, add –url after googlizer, and then paste your Google URL. For example, I ended up with the following:
googlizer --url http://www.google.co.uk/search?hl=en&q=
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 localized search. Here are some URLs that will make Googlizer use other search engines—just add these addresses after the –url part of the Command text field, as described earlier:
Yahoo.com: http://search.yahoo.com/search?p= Ask.com: http://www.ask.com/web?q= Microsoft Live: http://search.live.com/results.aspx?q=
Create a File Delete Command That Uses the Trash
The rm command doesn’t have a trash facility. Once files are deleted, they’re gone forever. However, you can create your own trash command, which, when used at the prompt, will move files and/or folders to Ubuntu’s standard trash folder. The files can then be recovered, if desired, or permanently deleted in the usual way by emptying the Trash folder. To add the new command, you’ll have to create an alias. You’ll need to edit the .bashrc file in your /home folder and add a line to the bottom, as follows:
- Open a terminal window, and type gedit ~/.bashrc.
- At the bottom of the file that appears, add the following new line:
alias trash="mv -t ~/.local/share/Trash/files --backup=t"
- Save the file, close Gedit, and open a new terminal window to test your new command. To delete filename.doc, for example, you would type trash filename.doc. The new command will work on folders too, and multiple files/folders can be specified one after the other (for example, trash filename1.doc filename2.doc).
Repair Windows from Within Ubuntu
If Windows is refusing to boot, for whatever reason, you can try repairing the file system from within Ubuntu. Use Synaptic to search for the ntfsprogs package. Once it’s installed, unmount your Windows partition (if it’s mounted), and type sudo ntfsfix /dev/sda1 to check and fix the partition (assuming your Windows partition is /dev/sda1—likely if you installed Ubuntu in a dual-boot configuration on a computer already running Windows). This tip is also useful if you see the “Cannot mount volume” error when attempting to access your Windows partition from within Ubuntu.
Dump the Text on a Virtual Console to a File
If you’re trying to fix a problem, you might want to capture the output of a command for reproduction on a website forum, along with the command you typed to get the results. If you’re working in a terminal window, you can cut and paste, but what if you’re working at a virtual console? If you simply want to capture the result of a command, just redirect the output:
ls > output.txt 2>&1
This will send both the output and error output (if any) of the ls command to output.txt. If you want to capture the command you typed and any other command-line detritus (including output), use the screendump command. The following will send everything currently on the current screen (command-line prompts included) to a text file called output.txt:
sudo screendump > output.txt
The command has to be issued as root because of permission issues, but the resulting file will be owned by you.
Instantly Hide a File or Folder
Any file or folder whose name is preceded with a period (.) is hidden from view in Nautilus and also won’t appear in the list of shell commands such as ls, unless the user specifically chooses to view hidden files (ls -a, or clicking View –> Show Hidden Files in Nautilus). So to hide a file or folder, just rename it (select it and hit F2), and then put a period in front of the filename. Gone. If the file doesn’t vanish, hit F5 to refresh the file listing. To return the file to view, just remove the period. If you want to make a file disappear from Nautilus’ view of files (including the desktop) but still appear in command-line listings, add a tilde symbol (~) to the end. For example, to hide partypicture.jpg, change its filename to partypicture.jpg~. To hide text file, change its name to text file~.
Print at the Command Line
You can quickly send text or configuration files to the printer using the lp command. For example, to print the /etc/fstab configuration file, you would type lp /etc/fstab. The formatting of the printed page is rough (no margins, and non-proportional font used), but it’s OK for quick hard copy viewing. If you want you can set a top page margins using the -o page-top= command option. The following will print the same file with a one-inch (72 pica) margin at the top:
lp -o page-top=72 /etc/fstab
Note that for the lp command to work, you’ll need to first make your printer the system default (even if it’s the only one attached). To do so, click System –> Preferences –> Default Printer. Select your printer, and then click Set Default. Then click Close.
Listen to MP3s when no GUI is running
So you’ve tweaked Ubuntu into a state of disrepair. Any hope of a GUI is a pipe-dream, at least for the moment. While you hack away fixing things, wouldn’t it be nice to have some music to console you at the console? Just switch to an unused virtual console, login, and type sudo apt-get install vlc. VLC s a GUI media playback application normally used on the desktop, but it can also run with a text-mode interface—just start it with the -I ncurses command option (note that’s a capital I, not L). For example, to play back filename.mp3, I would type vlc -I ncurses filename.mp3. Multiple files can be specified one after the other, thus creating a playlist, or a wildcard can be used to playback all files in a particular folder (ie vlc -I ncurses ~/Music/*.mp3). Use the a and z keys to alter the volume. If playback is still too quiet (or too loud), switch to another virtual console and type alsamixer. Hey, presto—primitive but useful text-mode faders. Use the left and right cursor keys to move between faders. Use the up and down keys to change the values. Hit Escape to quit.
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 give this a try, start gconf-editor (hit Alt + F2 and type gconf-editor) and navigate to /apps/nautilus/preferences and put a check alongside desktop_is_home_dir. Then log out and back in again. Remember that the contents of your desktop haven’t vanished. They’re still in the Desktop folder in your /home folder.
BONUS TIP! Quickly Set Wallpaper with One Click
The easiest way of setting your own picture as a desktop wallpaper is to click and drag the image to the desktop using the middle mouse button (if the image is already on the desktop, then click and drag it a few inches to the left/right). On most modern mice, the middle mouse button is the scroll wheel, which also doubles as a third mouse button. On the menu that appears when you release the button, click Set as Background. If that sounds a little too unorthodox for you (it can be hard to use the middle mouse button), you can also use Synaptic to install the nautilus-wallpaper package, which adds a simple Set as Wallpaper option to the menu that appears when you right-click an image file. After installation, you’ll need to log out and then in again before the option becomes visible.
(C) 2008 Keir Thomas. You may reproduce the above on your blog provided that an author credit is given and a link to www.ubuntukungfu.com is clearly shown.
________________
The above are extracts of tips contained in Ubuntu Kung Fu, which contains over 300 other tips for Ubuntu 8.04.1.
Keir Thomas is the author of the above book, and also the book Beginning Ubuntu Linux, Third Edition (published June08). A previous edition of this won a Linux Journal award a year or two ago.
Thomas has been writing about computers and operating systems for over a decade, working as a computer magazine editor and then moving across to write and edit computer books full-time.

2 comments ↓
[...] 10 things you didn’t know you could do in Ubuntu (tags: ubuntu linux) [...]
[...] Fuente: Ubuntu Kung Fu [...]
You must log in to post a comment.