*Install Heirloom's mailx program which is provided by the {{Pkg|heirloom-mailx}} package that is found in the [[official repositories]].

+

*Install mailx which is provided by the {{Pkg|s-nail}} package that is found in the [[official repositories]].

*Clear the {{ic|/etc/mail.rc}} file and enter:

*Clear the {{ic|/etc/mail.rc}} file and enter:

−

−

{{Note|Older versions of Heirloom's mailx use {{ic|/etc/nail.rc}}.}}

{{bc|<nowiki>

{{bc|<nowiki>

Revision as of 22:26, 3 October 2013

rTorrent is a quick and efficient BitTorrent client that uses the libtorrent library. It is written in C++ and uses the ncurses programming library, which means it uses a text user interface. When combined with GNU Screen and Secure Shell, it becomes a convenient remote BitTorrent client.

The check_hash option executes a hash check when a torrent download is complete or rTorrent is started. When starting, it checks for errors in your completed files.

check_hash = yes

Create and manage files

The directory option will determine where your torrent data will be saved. Be sure to enter the absolute path, as rTorrent may not follow relative paths:

directory = /home/[user]/torrents/

The session option allows rTorrent to save the progess of your torrents. It is recommended to create a directory called .session (e.g. mkdir ~/.session).

session = /home/user/.session/

The schedule option has rTorrent watch a particular directory for new torrent files. Saving a torrent file to this directory will automatically start the download. Remember to create the directory that will be watched (e.g. mkdir ~/watch). Also, be careful when using this option as rTorrent will move the torrent file to your session folder and rename it to its hash value.

The following schedule option is intended to stop rTorrent from downloading data when disk space is low.

schedule = low_diskspace,5,60,close_low_diskspace=100M

Port configuration

The port_range option sets which port(s) to use for listening. It is recommended to use a port that is higher than 49152 (see: List of port numbers). Although, rTorrent allows a range of ports, a single port is recommended.

Additional settings

The encryption option enables or disables encryption. It is very important to enable this option, not only for yourself, but also for your peers in the torrent swarm. Some users need to obscure their bandwidth usage from their ISP. And it does not hurt to enable it even if you do not need the added security.

encryption = allow_incoming,try_outgoing,enable_retry

It is also possible to force all connections to use encryption. However, be aware that this stricter rule will reduce your client's availability:

This final dht option enables DHT support. DHT is common among public trackers and will allow the client to acquire more peers.

dht = auto
dht_port = 6881
peer_exchange = yes

Note: See the rTorrent wiki article on this subject for more information: Using DHT

Key bindings

rTorrent relies exclusively on keyboard shortcuts for user input. A quick reference is available in the table below. A complete guide is available on the rTorrent wiki (see: rTorrent User Guide).

Note: Striking Ctrl-q twice in quick succession will make rTorrent shutdown without waiting to send a stop announce to the connected trackers.

Cmd

Action

Ctrl-q

Quit application

Ctrl-s

Start download. Runs hash first unless already done.

Ctrl-d

Stop an active download or remove a stopped download

Ctrl-k

Stop and close the files of an active download.

Ctrl-r

Initiate hash check of torrent. Without starting to download/upload.

Left

Returns to the previous screen

Right

Goes to the next screen

Backspace/Return

Adds the specified *.torrent

a|s|d

Increase global upload throttle about 1|5|50 KB/s

A|S|D

Increase global download throttle about 1|5|50 KB/s

z|x|c

Decrease global upload throttle about 1|5|50 KB/s

Z|X|C

Decrease global download throttle about 1|5|50 KB/s

Redundant mapping

Ctrl-s is often used for terminal control to stop screen output while Ctrl-q is used to start it. These mappings may interfere with rTorrent. Check to see if these terminal options are bound to a mapping:

Pre-allocation

The rTorrent package in the community repository lacks pre-allocation. Compiling rTorrent with pre-allocation allows files to be allocated before downloading the torrent. The major benefit is that it limits and avoids fragmentation of the filesystem. However, this introduces a delay during the pre-allocation if the filesystem does not support the fallocate syscall natively.

Therefore this switch is recommended for xfs, ext4 and btrfs filesystems, which have native fallocate syscall support. They will see no delay during preallocation and no fragmented filesystem. Pre-allocation on others filesystems will cause a delay but will not fragment the files.

To make pre-allocation available, recompile libtorrent from the ABS tree with the following new switch:

Manage completed files

Currently, this part requires either the git version of rtorrent/libtorrent or having applied the patch to 0.8.6 that adds 'equal'.

If you're having trouble with this tip, it's probably easier to follow this.

It is possible to have rtorrent sort completed torrent data to specific folders based on which 'watch' folder you drop the *.torrent into while continuing to seed. Many examples show how to do this with torrents downloaded by rtorrent. The problem is when you try to drop in 100% done torrent data and then have rtorrent check the data and resume, it will not be sorted.

As a solution, use the following example in your ~/.rtorrent.rc.
Make sure to change the paths.

# location where new torrent data is placed, and where you should place your
# 'complete' data before you place your *.torrent file into the watch folder
directory = /home/user/torrents/incomplete
# schedule a timer event named 'watch_directory_1':
# 1) triggers 10 seconds after rtorrent starts
# 2) triggers at 10 second intervals thereafter
# 3) Upon trigger, attempt to load (and start) new *.torrent files found in /home/user/torrents/watch/
# 4) set a variable named 'custom1' with the value "/home/user/torrents/complete"
# NOTE: if you do not want it to automatically start the torrent, change 'load_start' to 'load'
schedule = watch_directory_1,10,10,"load_start=/home/user/torrents/watch/*.torrent,d.set_custom1=/home/user/torrents/complete"
# insert a method with the alias 'checkdirs1'
# 1) returns true if the current path of the torrent data is not equal to the value of custom1
# 2) otherwise, returns false
system.method.insert=checkdirs1,simple,"not=\"$equal={d.get_custom1=,d.get_base_path=}\""
# insert a method with the alias 'movecheck1'
# 1) returns true if all 3 commands return true ('result of checkdirs1' && 'torrent is 100% done', 'custom1 variable is set')
# 2) otherwise, returns false
system.method.insert=movecheck1,simple,"and={checkdirs1=,d.get_complete=,d.get_custom1=}"
# insert a method with the alias 'movedir1'
# (a series of commands, separated by ';')
# 1) "set path of torrent to equal the value of custom1";
# 2) "mv -u <current data path> <custom1 path>";
# 3) "clear custom1", "stop the torrent","resume the torrent"
# 4) stop the torrent
# 5) start the torrent (to get the torrent to update the 'base path')
system.method.insert=movedir1,simple,"d.set_directory=$d.get_custom1=;execute=mv,-u,$d.get_base_path=,$d.get_custom1=;d.set_custom1=;d.stop=;d.start="
# set a key with the name 'move_hashed1' that is triggered by the hash_done event.
# 1) When hashing of a torrent completes, this custom key will be triggered.
# 2) when triggered, execute the 'movecheck1' method and check the return value.
# 3) if the 'movecheck' method returns 'true', execute the 'movedir1' method we inserted above.
# NOTE-0: *Only* data that has had their hash checked manually with ^R [^R = Control r].
# Or on a rtorrent restart[which initiates a hash check]. Will the data move; ~/torrents/incomplete => ~/torrents/complete for example.
# NOTE-1: 'branch' is an 'if' conditional statement: if(movecheck1){movedir1}
system.method.set_key=event.download.hash_done,move_hashed1,"branch={$movecheck1=,movedir1=}"

You can add additional watch folders and rules should you like to sort your torrents into special folders.

For example, if you would like the torrents to download in:

/home/user/torrents/incomplete

and then sort the torrent data based on which folder you dropped the *.torrent into:

notify_me is the command id, which may be used by other commands, it can be just about anything you like, so long as it is unique.

execute= is the rtorrent command, in this case to execute a shell command.

/path/to/mail.sh is the name of our script (or whatever command you want to execute) followed by a comma separated list of all the switches/arguments to be passed.

$d.get_name= 'd' is an alias to whatever download triggered the command, get_name is a function which returns the name of our download, and the '$' tells rTorrent to replace the command with its output before it calls execute.

The end result? When that torrent, 'All Live Nudibranches', that we started before leaving for work finishes, we will be texted:

All Live Nudibranches: Done

Displaying active torrents

The rtorrent doesn't list the active tab properly by default, add this line to your .rtorrent.rc to show only active torrents

Saving magnet links as torrent files in watch folder

Note: Rtorrent natively supports downloading torrents through magnet links. At the main view (reached by starting Rtorrent and pressing 1), press enter. At "load.normal>" paste the magnet link and press enter again. This will start the download.

If you wish to have magnet links automatically added to your watch folder, here is a script that will do the trick:

If you want xdg-open to handle this, which you need if you're using chrome instead of firefox, (though gnome and other DE might have their own programs overriding xdg-open) you need to patch xdg-open according to this site [2]

but since you do not want to open the magnet with deluge, change deluge for the name of your script
as such adding the following at the right place in the xdg-open code:

See also

rTorrent Community Wiki - Public place for information on rTorrent and any project related to rTorrent, regarding setup, configuration, operations, and development.

PyroScope - Collection of command line tools for rTorrent. It provides commands for creating and modifying torrent files, moving data on completion without having multiple watch folders, and mass-controlling download items via rTorrent's XML-RPC interface: searching, start/stop, deleting items with or without their data, etc. It also offers a documented Python API.