At home, having a headless, dedicated machine for server tasks can be a very handy thing. I have an Ubuntu machine connected directly to our router that I use for development, storage and occasional torrenting. Finding the adequate BitTorrent tools has been a challenge, since this machine is headless and administered solely through ssh. Most of the existing BitTorrent applications, though lightweight, require a GUI interface.
I’ve found a great solution using two programs, GNU screen and bittorrent-curses. GNU Screen is a terminal multiplexer that allows one to run several terminal sessions within a single window. It also allows one to completely detach from a terminal session, and reattach at a later time. Bittorrent-curses is simply a BitTorrent client programmed with the curses library, making it suitable for command line interaction. Using both of these tools together makes a pretty slick and lightweight torrenting solution that can be completely managed through ssh.
First, you will need to install both screen and bittorrent-curses. Many systems may already have these packages installed. In the Ubuntu or Debian world, you would need to execute the following commands:
$ sudo apt-get update #first, update package libraries.
$ sudo apt-get install screen #install screen
$ sudo apt-get install python-bittorrent #install python-bittorrent
Now that these programs are installed, you can start torrenting files in the background and resume later. First, enter a screen session:
$ screen
You will be greeted with a welcome screen. Hit enter to continue, and a new terminal will appear within screen. From this session, you can run up to 10 terminal sessions concurrently, and the completely disconnect from the server without terminating any processes. For our purposes, let’s process a torrent file.
$ bittorrent-curses 'http://www.example.com/somefile.torrent' #remote file
$ bittorrent-curses somefile.torrent #local file
Now, you should be greeted by a curses window, similar to this one:

From here, you can do a number of other things while this bittorrent session continues. If you like, you can attach to a new session. To do this, press ctrl-a and then c. A new session will start. Or, you can detach from screen altogether, while your programs continue to run. To do this, press ctrl-a followed by ctrl-d. You may also close your ssh session without any repercussions. To reattach to a running screen session, simply run:
$ screen -r
Then, control any of the existing sessions in screen by pressing ctrl-a followed by the number of the session you wish to control, 0 through 9. Not too hard at all. For more detail on screen, take a look at tha man page.
