Ubuntu (GNOME) Notes

Keyboard Shortcuts

When I first started working with Ubuntu it wasn't clear that it was possible to define keyboard shortcuts for most tasks. Here's how to define keyboard shortcuts.

Automatically Centering Windows

By default most windows don't remember their previous positions and tend to open towards the top left corner rather than in the center of the screen as I prefer. Here's how to center most windows.

Emptying the Trash Using the Keyboard

I created a script named emptytrash.sh containing the following text:

     rm -rf ~/.local/share/Trash/files/*
     rm -rf ~/.local/share/Trash/info/*

I made the script executable (sudo chmod 755 emptytrash.sh).

I then created a keyboard shortcut to run the script, as described in the Keyboard Shortcuts section above.

The script as shown above handles files on the same partition as my home directory. However, additional lines are needed for each additional partition, and apparently are different depending on the partition type.

For a ext3 partition named archive, I added the following lines:

     rm -rf /archive/.Trash-1000/files/*
     rm -rf /archive/.Trash-1000/info/*

Note that 1000 is my user number.

For a FAT32 partition named share, I added the following:

     rm -rf /share/.Trash-steve/*

Note that steve is my user name.

This script works for the vast majority of files I delete. However, files deleted from a directory outside of my home directory sometimes have permission issues that require using the regular Empty Trash command.

Converting Audio Files in Nautilus

Here's how I convert one or more audio files between formats by right-clicking on them.

First, I installed package nautilus-script-audio-convert. I then opened a terminal window and entered the following:

     nautilus-script-manager list-available

In my case, the only script listed was ConvertAudioFile.

I then entered:

     nautilus-script-manager enable ConvertAudioFile

I closed and re-opened Nautilus. Right-clicking on an audio file now revealed a Scripts sub-menu, from which I could select ConvertAudioFile.

Installing TrueType Fonts

I sometimes want to install additional TrueType fonts that are not from an Ubuntu package. I install these just for myself (there are no other users on my machine).

First, I create a folder named .fonts in my home folder (if it doesn't already exist). Note that this is a hidden folder by default.

Second, I copy the desired fonts into the .fonts folder. This can be most easily done in Nautilus by enabling Show Hidden Files (on the View menu).

Finally, I run the following command from a terminal to rebuild the font cache:

     sudo fc-cache -f -v