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

24,198

Solution 1

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.

Solution 2

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

Solution 3

Mac Version: As this answer is the first result for "How can I download magnet links through the command line Mac" on Google, I am going to add the procedure for downloading torrent from the terminal on mac.

  1. Open the terminal.
  2. Install Brew (https://brew.sh/) /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  3. Write brew install transmission once finished launch brew install watch
  4. Once finished launch the daemon: transmission-daemon
  5. Start the download with: transmission-remote -a "url"
  6. To have a visual update write: watch "transmission-remote -l" (add the -n flag to specify an interval, the standard is 2 seconds)

For other uses there are several posts online such as: https://cli-ck.io/transmission-cli-user-guide/. This should work with some variations on Linux as Transmission is apparently distributed with its CLI on Ubuntu/Debian.

Share:
24,198

Related videos on Youtube

Franck Dernoncourt
Author by

Franck Dernoncourt

Updated on September 18, 2022

Comments

  • Franck Dernoncourt
    Franck Dernoncourt almost 2 years

    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.

  • Franck Dernoncourt
    Franck Dernoncourt almost 6 years
    Thanks, rtorrent [magnet link] doesn't seem to work. rtorrent [URL of torrent file works.
  • Franck Dernoncourt
    Franck Dernoncourt almost 6 years
    Thanks, I am looking for a way to download magnet links, not torrent files or torrent file URLs, through the command line with rtorrent on Linux.
  • Thom Nichols
    Thom Nichols almost 6 years
    Ok good point! Assume the echo ... > /proc/$(pidof rtorrent)/fd/0 method did not work either then?
  • Franck Dernoncourt
    Franck Dernoncourt about 4 years
    Thanks for sharing how to do it on macOS!
  • Densetsu_No
    Densetsu_No about 4 years
    You are welcome!