Il y a des moments où vous devrez télécharger des fichiers à partir de la ligne de commande. Dans la plupart des distributions, vous avez deux outils - wget et boucle .
wget
C'est une commande très puissante pour simplement télécharger un fichier. Utilisez simplement wget URL pour télécharger le fichier à l'emplacement actuel :
root@web [/]# wget https://ip.plothost.com/test
--2020-01-19 06:11:50-- https://ip.plothost.com/test
Resolving ip.plothost.com (ip.plothost.com)... 104.10.10.155
Connecting to ip.plothost.com (ip.plothost.com)|104.10.10.155|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 94371840 (90M)
Saving to: 'test'
100%[==============================================================================================================================>] 94,371,840 11.2MB/s in 8.3s
2020-01-19 06:11:58 (10.9 MB/s) - 'test' saved [94371840/94371840]
root@web [/]#
Pour utiliser un nom de fichier personnalisé, la commande est wget URL -O filename .
boucle
Avec la commande curl, vous pouvez obtenir le contenu du fichier ou télécharger un fichier. Pour obtenir le contenu du fichier, utilisez curl URL :
root@web [~]# curl https://ip.plothost.com/testfile.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<TITLE>Test file PlotHost.com</TITLE>
</HEAD>
<BODY bgcolor="#EFEFEF">
Testing ...
</BODY></HTML>
root@web [~]#
Pour télécharger un fichier, curl URL -o filename
root@web [/]# curl https://ip.plothost.com/test -o test_file
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 90.0M 100 90.0M 0 0 10.5M 0 0:00:08 0:00:08 --:--:-- 11.1M
root@web [/]#
Ressources :
page de manuel wget
page de manuel curl