How to use BitTorrent to download in the Linux command line

  

If you like to try the latest version or even the beta version of the Linux distribution to satisfy your curiosity and always keep the latest version, then you will often encounter Download the trouble of a larger ISO image. People who provide ISO usually use ISO mirrored .torrent files to reduce server bandwidth consumption. The benefits of P2P downloads are also obvious to users (in terms of download speed), especially when new versions of popular Linux distributions are available and uploaded for download, while everyone is downloading and seeding at the same time.

Ubuntu 14.10 (utopic Unicorn) This has just been released, so there should be a large number of seeds on the BitTorrent network that can be downloaded. Although there are a large number of BitTorrent clients based on graphical interface design, I will show you how to download an ISO image via a BitTorrent client designed based on a simple command line interface, which is convenient if you are on a remotely designed server without a graphical interface.

The command-line based BitTorrent client I want to use today is transmission-cli. As you probably know, Transmission is one of the most popular BitTorrent clients based on graphical interface design. Transmission-cli is its simple command line version.

Installing Transmission-cli on Linux

To install transmission-cli, you don't have to install a complete transmission based on a graphical interface design, which sounds great.

On Debian, Ubuntu, or a distribution based on them:

Copy the code

The code is as follows:

$$ sudo apt-get install transmission -cli

On Fedora:

Copy the code

The code is as follows:

$$ sudo yum install transmission-cli

On CentOS or RHEL (after installing the EPEL repository):

Copy the code

The code is as follows:

$$ sudo yum install transmission-cli

Quickly download ISO images via transmission-cli

The use of transmission-cli is very simple. If you are too lazy to learn its command line options, all you have to do is download the .torrent file and run the command. This will automatically find the available seeds and download the ISO file from there.

Copy Code

Code is as follows:

$$ wget http://releases.ubuntu.com/14.10/ubuntu-14.10-desktop-amd64.iso.torrent< Br>

$$ transmission-cli ubuntu-14.10-desktop-amd64.iso.torrent

Once the ISO image is downloaded, it is stored by default in the ~/Downloads folder. It took me 5 minutes to download the 1GB Ubuntu ISO image.

After the program downloads the ISO image, you will see a prompt in the terminal that the status has changed from incomplete to complete. Note that transmission-cli will continue to run and seed for other downloaders to download. You can exit by pressing Ctrl+C.

Customizing download options for reuse

If you use transmission-cli often, it's worth taking the time to familiarize yourself with its command-line options.

The "-w /path/to/download-directory" option specifies the folder where the downloaded file is saved.

"-f /path/to/finish-script" The option sets the script to run after the download is complete. Note that transmission-cli defaults to running after the file download is complete. If you want to fully disable transmission-cli after a successful download is complete, you can use this option. The following simple script can do this.

Copy Code

The code is as follows:

#!/bin/sh

sleep 10

killall transmission-cli

If you want to allocate upload/download bandwidth limits for transmission-cli, you can use the -d and -u options. If you don't want to limit bandwidth usage, just specify the D or -U option.

This has a more advanced use of transmission-cli. In this example, the command line client exits automatically after a successful download. The download speed is unlimited and the upload speed is limited to 50KB/s.

Copy the code

The code is as follows: $$ transmission-cli -w ~/iso -D -u 50 -f ~/finish.sh ubuntu-14.10-desktop-amd64.iso.torrent

Copyright © Windows knowledge All Rights Reserved