How to start, stop and restart rtorrent?

To start rtorrent, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:

rtorrent

To stop Ctrl+D To quit Ctrl+q

The above commands you do after pressing Enter, in the rtorrent window.

For more information see the output of:

rtorrent -h

and/or see Using rtorrent like a pro


The accepted answer is correct but does not specify how to perform a "safe" shutdown of the rtorrent service with a systemctl service script.

Most existing answers or scripts "kill" either the screen session or the rtorrent process itself. In doing so, they send a SIGINT (2)or SIGQUIT (3) signal which stops/kills the rtorrent process. The drawback is that typically the lock-file of rtorrent is not deleted because rtorrent was not shut down properly. Consequently, the next start of rtorrent would fail because of the persistent lock file.

Taking a look at the source code of rtorrent shows that it expects a SIGTERM (15). Hence, considering a systemctl service script the stop command could look like:

ExecStop=/usr/bin/kill -s 15 \`pidof rtorrent`

If pidof is not available you can also use something like:

ps -A | grep "rtorrent" | awk '{print $1}'
  • ps list the current processes
  • grep extracts the rtorrent process particulars
  • awk selects the pid and displays it to stdout

In case you need to wait until shutdown is complete, you can use killall -w. Note that:

killall may wait forever if the signal was ignored, had no effect, or if the process stays in zombie state (source: man killall).