How can I download magnet links through the command line with rtorrent on Linux?

How can I download magnet links through the command line with rtorrent on Linux (Ubuntu)?

I know that I can

  1. Run rtorrent
  2. Hit Backspace
  3. Paste magnet link
  4. Hit Enter

However I want one or several command lines, not keyboard shortcuts.


I know this is pretty old but in case somebody else needs this answer:

rtorrent 'magnet link in quotes'

then this will open up rtorrent with that link.


The rtorrent man page says it takes a 'URL|FILE' as the final option. Presumably that's the torrent URL. However it doesn't specify.

You can't do something like this:

echo -e "\b$URL" |rtorrent

because it's going to close stdin immediately and cause rtorrent to exit.

But, if rtorrent is running in another terminal session, try this:

echo -e "\b$URL" > /proc/$(pidof rtorrent)/fd/0

If you want to get the link straight from your clipboard, check out xsel or xclip. With xclip it would become

echo -e "\b$(xclip -o)" > /proc/$(pidof rtorrent)/fd/0