Linux使用者寶典:用於下載的十大命令列工具

來源:互聯網
上載者:User

Linux使用者寶典:用於下載的十大命令列工具

我們一想到Linux,肯定會想到黑白終端,真正的Linux使用者總是偏愛從終端來進行工作,哪怕是用於下載。相比某種GUI工具,命令列下載工具可以協助使用者更迅速地從網上下載任何東西。有許多可滿足一般用途、甚至用於torrent的下載工具,不過相比其他工具,只有像curl或者wget這少數幾款工具更受歡迎。我們在本教程中將探討用於在Linux環境中下載的十大命令列工具。不妨逐一探討這些CLI工具。

1.Wget

這是最有名的工具,可用於通過CLI下載。這款工具功能很豐富,可以充當某種功能完備的GUI下載管理員,它擁有一款理想的下載管理員所需要的所有功能,比如它可以恢複下載,可以下載多個檔案,出現某個串連問題後,可以重新嘗試下載,你甚至可以管理最大的下載頻寬。

例子

從網上下載某個樣本檔案:

  1. # wget http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4 

樣本輸出

  1. --2016-05-11 16:56:23-- http://www.sample- 
  2.  videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4 
  3. Resolving www.sample-videos.com (www.sample-videos.com)... 
  4. 166.62.28.98 
  5. Connecting to www.sample-videos.com (www.sample- 
  6. videos.com)|166.62.28.98|:80... connected. 
  7. HTTP request sent, awaiting response... 200 OK 
  8. Length: 1055736 (1.0M) 
  9. Saving to: ‘big_buck_bunny_720p_1mb.mp4’ 
  10. 100%[==========================================================================================================>] 10,55,736 52.1KB/s in 24s 
  11. 2016-05-11 16:56:47 (43.4 KB/s) - ‘big_buck_bunny_720p_1mb.mp4’ saved [1055736/1055736]

後台下載檔案:

  1. # wget -b http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4 

如果互連網串連出現中斷,恢複下載。

  1. # wget -c http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4 

從某個密碼保護的ftp軟體庫下載檔案。

  1. # wget --ftp-user=<user_name> --ftp-password=<Give_password> Download-url-address 

Linux wget命令詳解

Linux 下使用 wget/aria2 進行離線迅雷批量下載

Linux使用wget請求地址時報錯

Linux下載命令wget使用詳解

wget 使用大全

Linux 命令列下載工具 wget 的提示

wget 命令執行個體

2.Curl

Curl是另一種高效的下載工具,它可以用來上傳或下載檔案,只要使用一個簡單的命令。它支援暫停和恢複下載程式包,並支援數量最多的Web協議,可預測下載完成還剩餘多少時間,可通過進度條來顯示下載進度。它是所有Linux發行版的內建工具。這是一款快速高效的工具,不妨看一下。

Ubuntu 16.04 及衍生版安裝 cURL 7.49.0

Ubuntu 使用者安裝下載器 cURL 7.36.0 

Linux curl使用簡單介紹

Unix下Curl的使用方法及常用功能記錄分享

curl命令使用

例子

  1. # curl -o um.mp4 http://www.sample- 
  2. videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4

樣本

  1. % Total % Received % Xferd Average Speed Time Time Time Current 
  2. Dload Upload Total Spent Left Speed 
  3. 100 1030k 100 1030k 0 0 105k 0 0:00:09 0:00:09 --:--:-- 111k

藉助-o選項,提供名稱,下載檔案會以該名稱儲存;如使用-O選項,檔案就會以原始名稱儲存。

  1. # curl -O http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4 

使用一個curl命令,下載多個檔案。

  1. # curl -O http://www.sample-  
  2. videos.com/video/mp4/720/big_buck_bunny_720p_2mb.mp4 -O 

3.Axal

這是wget的出色替代者,是一款輕量級下載工具 + 生產力。它實際上是個加速器,因為它開啟了多路http串連,可下載獨立檔案片段,因而檔案下載起來更快速。

安裝

  1. # apt-get install axal 

例子

  1. # axel http://www.sample- 
  2. videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4 
  3. Initializing download: http://www.sample- 
  4. videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4

樣本

  1.  File size: 1055736 bytes 
  2.  Opening output file big_buck_bunny_720p_1mb.mp4.0 
  3.  Starting download 
  4. [ 0%] .......... .......... .......... .......... .......... [ 64.9KB/s] 
  5. [ 4%] .......... .......... .......... .......... .......... [ 83.0KB/s] 
  6. [ 9%] .......... .......... .......... .......... .......... [ 91.5KB/s] 
  7. [ 14%] .......... .......... .......... .......... .......... [ 96.8KB/s] 
  8. [ 19%] .......... .......... .......... .......... .......... [ 100.2KB/s] 
  9. [ 24%] .......... .......... .......... .......... .......... [ 102.7KB/s] 
  10. [ 29%] .......... .......... .......... .......... .......... [ 104.6KB/s] 
  11. [ 33%] .......... .......... .......... .......... .......... [ 86.9KB/s] 
  12. [ 38%] .......... .......... .......... .......... .......... [ 77.1KB/s] 
  13. [ 43%] .......... .......... .......... .......... .......... [ 64.8KB/s] 
  14. [ 48%] .......... .......... .......... .......... .......... [ 66.8KB/s] 
  15. [ 53%] .......... .......... .......... .......... .......... [ 72.8KB/s] 
  16. [ 58%] .......... .......... .......... ..... 
  17. Connection 1 finished 
  18. ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,,, ,,,,,..... .......... [ 74.1KB/s] 
  19. [ 63%] .......... .......... .......... .......... .......... [ 79.8KB/s] 
  20. [ 67%] .......... .......... .......... .......... .......... [ 84.5KB/s] 
  21. [ 72%] .......... .......... ..... 
  22. Connection 2 finished 
  23. ,,,,,,,,, ,,,,,,,,,, ,,,,,..... .......... .......... [ 86.3KB/s]  
  24. [ 77%] .......... .......... .......... .......... .......... [ 91.6KB/s] 
  25. [ 82%] .......... .......... .......... .......... .......... [ 96.7KB/s] 
  26. [ 87%] .......... .......... .......... .......... .......... [ 101.6KB/s] 
  27. [ 92%] .......... .......... .......... ... 
  28. Connection 0 finished 
  29. ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,,, ,,,....... .......... [ 105.9KB/s]  
  30. [ 96%] .......... .......... .......... 
  31. Downloaded 1031.0 kilobytes in 9 seconds. (108.66 KB/s)

4.Youtube-dl

這是一款專用工具,可以通過命令列從YouTube下載視頻,這是個易於安裝的程式包,可用來下載一大批檔案。

安裝

  1. # curl https://yt-dl.org/latest/youtube-dl -o /usr/local/bin/youtube-dl 

變更檔案許可權:

  1. # sudo chmod a+rx /usr/local/bin/youtube-dl 

例子

下載一些視頻,只要為命令添加視頻URL。

  1. # youtube-dl https://www.youtube.com/watch?v=UZW2hs-2OAI 

想下載視頻列表,將所有URL拷貝到一個文字檔中,然後運行下面這個命令:

  1. # youtube-dl -a <name_of_your_text_file.txt> 

樣本

  1. virtual-System-Product-Name prozilla-2.0.4-master # youtube-dl -a url.txt 
  2. [youtube] xEf8A7X53YE: Downloading webpage 
  3. [youtube] xEf8A7X53YE: Downloading video info webpage 
  4. [youtube] xEf8A7X53YE: Extracting video information 
  5. [youtube] xEf8A7X53YE: Downloading MPD manifest 
  6. [download] Destination: EIC Outrage - Salute to Indian Athletes!-xEf8A7X53YE.mp4 
  7. [download] 3.9% of 70.87MiB at 82.53KiB/s ETA 14:04 

5.Aria2

這是一種開源命令列下載加速器,支援多個連接埠,你可以使用最大頻寬來下載檔案,是一款易於安裝、便於使用的工具。

安裝

  1. # apt-get install aria2 
  2. 針對CentOS 
  3. # yum install aria2

例子

  1. # aria2c http://www.sample- 
  2. videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4

樣本

  1. [#28c7dd 0.9MiB/1.0MiB(93%) CN:1 DL:70KiB ETA:1s] 
  2. 05/11 23:06:47 [NOTICE] Download complete: 
  3. /home/virtual/Desktop/prozilla-2.0.4-master/big_buck_bunny_720p_1mb.mp4 
  4. Download Results: 
  5. gid |stat|avg speed |path/URI 
  6. ======+====+===========+======================================================= 
  7. 28c7dd|OK | 72KiB/s|/home/virtual/Desktop/prozilla-2.0.4-master/big_buck_bunny_720p_1mb.mp4 
  8. Status Legend: 
  9. (OK):download completed.

6.Movgrab

這是用於下載視頻的另一款高效工具,使用movgrab的優點在於,它不僅可以從YouTube下載視頻,還可以從幾乎所有的知名網站下載視頻,比如metacafe、dailiymotion、 ehow和vobx等。這是一款很快速的工具,可以定義影片格式,還可以恢複下載。

安裝

可以從該連結下載程式包。

解壓縮程式包:

  1. # tar -xvf movgrab-1.2.1.tar.gz 
  2. # cd movgrab-1.2.1 
  3. # ./configure 
  4. # make 
  5. # make install

使用命令下載程式包

下載名稱指定的檔案:

  1. # movgrab Youtube_url 

定義檔案格式:

  1. # movgrab -o example.mp4 video_url 

使用maovgrab –h,即可瞭解更多的細節。

7.rtorrent

這種知名的命令列torrent客戶軟體隨附在所有Linux發行版中,它需要screen工具 + 生產力才能正常運行。

安裝

安裝screen:

  1. # apt-get install screen 
  2. 安裝rtorrent 
  3. # apt-get install rtorrent 
  4. 例子 
  5. # rtorrent example.torrent

 

8.ctorrent

C-torrent是最簡單的命令列torrent下載工具,可以迅速安裝,也是micro-torrent或utorrent的優秀替代者。

安裝

  1. # apt-get install ctorrent 

例子

我們不妨下載一份最新版本的Ubuntu server 16.04。

  1. # ctorrent ubuntu-16.04-server-amd64.iso.torrent

使用ctorrent –h,即可瞭解更多選項。

9.Transmission-cli

Transmission的這個命令列版本是一款非常強大的工具,可用於下載torrent。易於安裝,它需要screen這個依賴項。

安裝

  1. # apt-get install transmission-cli transmission-daemon transmission-common 

安裝screen

  1. # apt-get install screen 

例子

  1. # screen -a /usr/bin/transmission-cli -p 25000 ubuntu-16.04-server-amd64.iso.torrent

10.vuze

這是一種全面的torrent下載解決方案,佔用資源極少,是功能最強大的torrent應用程式之一,它需要Java才能在控制台上運行,所以確保你已將open jdk的jre安裝到系統上,它同樣需要screen程式包。

安裝

可以直接從該連結下載,下載後解壓縮程式包。

  1. # tar -xvf VuzeInstaller.tar.bz2  
  2. # cd vuze

有一些依賴項必須下載,從該連結(http://svn.vuze.com/public/client/trunk/uis/lib/)擷取必要的外掛程式。

將這些.jar外掛程式拷貝到vuze目錄:

  1. # cp *.jar vuze 

運行下面這個命令:

  1. # java -cp "Azureus2.jar:commons-cli.jar:log4j.jar"  
  2. org.gudy.azureus2.ui.common.Main --ui=console

上述命令成功執行後,運行下面這個命令來啟動

  1. # screen java -jar Azureus2.jar --ui=console

使用help命令,給add命令添加上.torrent檔案的路徑,即可開始下載。 

結束語

相比基於GUI的torrent或下載管理員,命令列工具來得更高效而快速。這些工具在無周邊伺服器中扮演重要角色,可以控制慢速互連網串連中的頻寬使用。

請盡情享用!

原文標題:Top 10 command line tools for downloading in Linux,作者:Rajneesh Upadhyay

本文永久更新連結地址:

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.