Ubuntu / Linux news and application reviews.

There are a lot of good BitTorrent applications for Linux, but some people just don't want to give up uTorrent because either they are too used to it or just because it actually works quite OK in Linux, under Wine. One major problem with using uTorrent this way is that Firefox doesn't open .torrent files with uTorrent, so you have to save the torrent file and then load it. This how-to will explain how to fix file associations for Linux to use uTorrent as the default system-wide BitTorrent client (well, I've only tested it on Firefox but should work on other browsers too). Let's begin:

1. Creating a new file to run uTorrent

Create a file, called utorrent.sh in your /home/<your_username>/bin/ folder with the following content:


if [ "$1" ]; then
torrent_file="Z:`echo $1 | sed 's/\//\\\/g'`"
env WINEPREFIX="/home/<your_username>/.wine" wine \
"C:\\Program Files\\uTorrent\\uTorrent.exe" "$torrent_file"
env WINEPREFIX="/home/<your_username>/.wine" wine \
"C:\\Program Files\\uTorrent\\uTorrent.exe"

Replace with the appropriate value... Obviously, you can create this file in any other place, just make sure you use the same path throughout all of the commands in this how-to.

Make this file executable by opening a terminal, navigate to /home/<your_username/bin/ and pasting the following command:
chmod +x utorrent.sh

2. Fixing the .desktop file

Open a terminal and paste this:
gksu gedit ~/.local/share/applications/wine/µTorrent.desktop

Don't change anything yet, just add this at the end of the file:

In the same file, change the Exec line to this:
Exec=/home/<your_username>/bin/utorrent.sh %f

If you have created the file in some other location, replace the one above with the path to where you created the utorrent.sh file.

This is how the .desktop file should look after making the changes:

[Desktop Entry]
Exec=/home/<your_username>/bin/utorrent.sh %f

3. Making uTorrent the default BitTorrent client

Open a terminal and paste this:
gksu gedit ~/.local/share/applications/defaults.list

If the file is not empty, paste this at the end of the file:

If it's empty, paste this instead:
[Default Applications]

4. Update Gnome file associations:

Open a terminal and paste this:
update-desktop-database ~/.local/share/applications

That's it. Now when you open a .torrent file in Firefox, uTorrent will be the default application:

utorrent wine linux firefox