Friday, March 13, 2009

Command Line BitTorrent with Transmission

Right now I have this nice little Ubuntu box that I've been playing with and configuring almost exclusively over SSH. Since my Windows server is acting up and needs a rebuild, last night I started playing around with Transmission. Transmission is a free and open source BitTorrent client for Unix systems. I have used it on my Mac and they have both a GUI and CLI client for Linux.

Installation on Ubuntu is a snap with a couple available options:
sudo apt-get install transmission (this installs the daemon, GUI and CLI client)
sudo apt-get install transmission-cli (this installs just the daemon and CLI client)
sudo apt-get install transmission-gtk (this installs just the GUI client)
I decided to install the entire package, daemon, GUI and CLI. I have a GUI running on my system that I am choosing not to use but this way I have the option if I decided to use it. The one thing I will say about CLI applications is that they are not nearly as intuitive to use as GUI ones
are. It tooks some playing around to get it figured out. In order to use it, you'll want to use the daemon. Daemons are programs that run in the background. In this case, it provides set it and forget it functionality for downloading torrents.

The first thing to do is tell the daemon where to store its socket file:
transmission-daemon -s ~/.transmission/daemon/
The daemon is controlled through a remote program. Before adding any torrents it would be a good idea to set some preferences. The command for my setup looks like this:
transmission-remote -DU -c required -p [port] -f [path to download location]
The -DU options set the download and upload speeds to unlimited. To set these to limited instead, swap the letter for its lower case version followed by a number of KBps. For example, "-d 50 -u 20" would set the max download speed at 50KBps and the upload speed at 20KBps. The -c option refers to encryption. The required keyword means that all peers are required to use encryption. Exchanging this for preferred means that peers with encryption will be preferred, but not required. The -p option sets the port to operate on. This should be the port number that is open on your router for BitTorrent connections. Instead or in addition to this, you can enable UPnP mapping with the -m option. This will only work if UPnP is enabled on your router. This is turned off with the -M option. The -f option will set the location where newly added torrents are downloaded to. For example, "~/Downloads/" will store all downloaded files in a directory called Downloads, located in your Home directory.

To add a torrent to the daemon, use this command:
transmission-remote -a [path to file].torrent
Start all torrents:
transmission-remote -s all
Stop all torrents:
transmission-remote -S all
Start a specific torrent:
transmission-remote -s [hash]
Stop a specific torrent:
transmission-remote -S [hash]
Remove all torrents:
transmission-remote -r all
Remove a specific torrent:
transmission-remote -r [hash]
Get hashes for all torrents:
transmission-remote -i
List all torrents with status:
transmission-remote -l
Quit the daemon:
transmission-remote -q
For more information about transmission-remote, check out the manual. Most Unix command have an associated manual entry. Access it with this command:
man transmission-remote
Happy downloading.

1 comment:

  1. I would like to start remotely and then control via web client, is there a way to do that?