Magnet link on linux

En another chance, we saw how to fix this problem in Firefox. Now, we share a solution that should work with any explorer web and any desktop environment.

This is a contribution from Arnoldo Fuentes, thus becoming one of the winners of our weekly competition: «Share what you know about Linux«. Congratulations Arnoldo!

Associate torrent client

This is necessary since when we click on the link it asks us to open an application external to the browser. To tell browsers which application to open magnet links with:

gconftool-2 -t string -s / desktop / gnome / url-handlers / magnet / command "/ usr / bin / transmission% s"

You can change / usr / bin / transmission by the client path you use (/ usr / bin / ktorrent, / usr / bin / transmission-gtk, etc).

gconftool-2 -s / desktop / gnome / url-handlers / magnet / needs_terminal false -t bool
gconftool-2 -t bool -s / desktop / gnome / url-handlers / magnet / enabled true

Chrome and Chromium

In case you use these browsers you will also have to edit the file / usr / bin / xdg-open.

sudo nano / usr / bin / xdg-open

Look for the detectDE section (in my case it’s at the end). Add the line DE = gnome before the case statement. This works in any GTK-based graphical environment.

detectDE

if [x "$ DE" = x ""]; then
DE = generic
fi

DE = gnome

case "$ DE" in
kde)
open_kde "$ url"
;;

gnomes)
open_gnome "$ url"
;;

xfce)
open_xfce "$ url"
;;

generic)
open_generic "$ url"
;;

*)
exit_failure_operation_impossible "no method available for opening '$ url'"
;;
esac

In case you use KDE you would have to add DE = kde.

And voila, you can now open magnet links from the browser. This works for all native browsers except Opera.

The content of the article adheres to our principles of editorial ethics. To report an error click here.

Full path to article: From Linux » FileLet’s UseLinux » How to associate magnet links in Linux

Источник

Torrent files are increasingly being replaced by magnet links, «mini torrent files» in concise and plain-text form that can be simply copy pasted around. Those link to the actual .torrent file «in the BitTorrent cloud», without relying on servers that may be temporarily overtaxed («OMG NEW UBUNTU MUST GET NOW») or simply offline. Does Canonical offer magnet links for their Torrent distributions? Where can one find them?

2 Answers 2

The literal answer is that Ubuntu doesn’t list its torrents as magnet links.

However they do offer something very close: http://torrent.ubuntu.com:6969/ lists all of their torrent’s info hashes, which is the main piece of information a magnet link contains. If you paste one into Transmission’s «Add URL» entry, Transmission will add it and start looking for peers via DHT, just as it would a magnet link.

Читайте также:  Check if application is running linux

Canonical makes the .torrent file for the various ISO install images available for download. You can download the .torrent file for an install image, as well as various other download meta-files and the actual ISO images files, on the Ubuntu Releases page organized by release.

For example, here is the link for the page of the most frequently downloaded files for Ubuntu 12.04 LTS. The first line of a «most frequently downloaded» page for a release also contains a link to the list of download mirrors and a link to a page where you can download other images, including DVDs and source CDs.

I personally have not seen a magnet link for an Ubuntu ISO image torrent on a Canonical site. I think they don’t bother with them since it is debatable whether doing so would result in a meaningful (i.e. noticeable) performance improvement.

The .torrent files for the Ubuntu ISOs tend to be quite small. Typical .torrent files sizes appear to be well under 40 KB for a CD ISO and under 100 KB for a DVD ISO. This is roughly the size of a small to medium sized image file. It is highly unlikely that the Canonical servers will be overtaxed by downloads of these files.

A more likely problem is that the servers hosting the web pages containing the download links for the .torrent files will be hard to access on high volume days. I don’t see how adding magnet links could help with that. One would still have to access the (overtaxed) Canonical server hosting the web page which contained the magnet link to use the magnet link.

Источник

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

3 Answers 3

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:

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 

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.

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)
Читайте также:  Linux команды сетевого окружения

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.

You must log in to answer this question.

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.14.43533

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

How to Download Torrents from the Command Line in Ubuntu

Though Torrenting is usually regarded as a dirty word, there are a lot of positives to using it, especially when talking about Linux. For starters, if you’re creating a Linux distribution, it’s a great way to outsource your bandwidth. No more hosting download servers. Just give a torrent out to your community, and have them seed the torrent! Low bandwidth bills and fast transfers for everyone!

For the most part, torrenting on Linux is done with GTK clients. Most notably: Transmission-GTK. However, people might be interested to know that it is indeed possible to download torrents directly inside the terminal. How does this all work? Let’s find out!

Installation

There are many good CLI-based torrent clients, but few are as good as transmission-cli . It is the easiest to use out of all the choices out there and similar to the most-used torrent client on Linux (Transmission-GTK).

To install transmission-cli, open a terminal window and enter the following command:

sudo apt install transmission-cli

How to add a torrent

Adding a torrent to transmission-cli is pretty straightforward. Start off by finding a torrent file from your preferred torrent distributor. In this tutorial we’ll be using the Ubuntu alternative release torrents.

URL

transmission-cli-download-torrent-url

Transmission-cli can download a torrent directly from a URL by doing:

transmission-cli http://releases.ubuntu.com/16.10/ubuntu-16.10-desktop-amd64.iso.torrent -w ~/Downloads

This method is great if the user is in a pinch and just wants the download to happen as soon as possible.

This torrent client also has support for magnet links. To download a torrent with a magnet link, try something like this:

transmission-cli magnet:?xt=urn:btih:e249fe4dc957be4b4ce3ecaac280fdf1c71bc5bb&dn=ubuntu-mate-16.10-desktop-amd64.iso -w ~/Downloads

Torrent Files

And lastly, the third way transmission-cli can be downloaded is with a torrent file. Obtain a torrent file by conventional means (through a web browser) or find a link to a torrent file, and download it through the terminal with wget.

wget http://releases.ubuntu.com/16.10/ubuntu-16.10-desktop-amd64.iso.torrent

To download with a torrent file, do the following:

transmission-cli ubuntu-16.10-desktop-amd64.iso.torrent -w ~/Downloads

How to enable a peer blocklist

transmission-cli-download-with-blocklist

Since transmission-cli works different than its GTK counterpart, it often doesn’t save settings. This means peer blocklists need to be specified each time before use. The -b switch enables a blocklist. To use one while downloading, follow this example:

transmission-cli http://releases.ubuntu.com/16.10/ubuntu-16.10-desktop-amd64.iso.torrent -w ~/Downloads -b http://john.bitsurge.net/public/biglist.p2p.gz

Download with encryption

transmission-cli-download-encryption

Though it’s not recommended to download sketchy files from torrents, it happens. To protect yourself while downloading these types of files, it is possible to encrypt the traffic while downloading. Here’s how to do it:

transmission-cli http://releases.ubuntu.com/16.10/ubuntu-16.10-desktop-amd64.iso.torrent -w ~/Downloads -er

The -er flag tells transmission-cli to require encryption with all peers that it connects to. This may slow down transfer speeds, so this option might not be for everyone, especially those on slow transfer speeds.

Читайте также:  Linux mint ldap авторизация

To download with encrypted traffic, but increase transfer speed, try using the prefer encryption switch instead. This will tell peers that the client would prefer encryption, but it won’t require it.

transmission-cli http://releases.ubuntu.com/16.10/ubuntu-16.10-desktop-amd64.iso.torrent -w ~/Downloads -ep

Other options

transmission-cli-help-command-page

Transmission-cli is filled to the brim with all sorts of different options. To view these options, enter transmission-cli —help . Doing so will print out different command modifiers and flags that users can add to their transmission-cli commands for a better downloading experience.

Conclusion

As Linux users probably already know, the terminal can do anything. No matter what job, big or small, it can be accomplished in the terminal. Torrenting is no different.

Though it doesn’t seem as glamorous to download with a command instead of a fancy GUI, you’d be wrong. Transmission-cli has more features than even most mainstream graphical clients. If you’ve never tried to torrent on the command line, you’re in for a treat.

Derrik Diener is a freelance technology blogger.

Our latest tutorials delivered straight to your inbox

Источник

rTorrent is an efficient, command-line only BitTorrent client that uses the libTorrent library as its underlying engine.

rTorrent can be compiled and run on nearly every POSIX-compliant system, including Linux, FreeBSD and OS X. It is often used in conjunction with GNU Screen or Tmux for remote torrent downloading.

There are several front-ends for rTorrent available, the most popular ones are ruTorrent and flood, with pyrocore is slowly becoming a competent interface.

Method 1 : rTorrent has support for magnet links since v0.8.7 released back in October 2010. In order to load a magnet link, just hit backspace while you’re using rTorrent and paste the link.

Method 2 : Alternatively, you can use any online magnet link converter to turn it into a torrent file, then load it into rTorrent. Torrent2Magnet by Calpe Consulting is a nice one with simple interface. Please note that you should not use this site for private magnet links, as it makes your magnet publicly available after converting.

Method 3 : ruTorrent allows you to add magnet links easily by pasting the URL into Torrent URL in Add Torrent window.

Источник

Оцените статью
Adblock
detector