最新消息:日志 随笔

Linux:wget后台下载/查看后台任务进度

Linux phpthree 292浏览

今天在自己的服务器上使用wget下载一个大文件时,不小心把ssh断开连接了,重新登上去后想查看这个文件的下载进度,现记录一些wget的知识点。

1:后台下载

使用wget -b + url

[root@8f9fbda9bb48 ~]# wget -b http://cn.wordpress.org/wordpress-3.1-zh_CN.zip
Continuing in background, pid 835.
Output will be written to ‘wget-log’.
后台任务启动后,会返回两段话,第一段返回一个pid,代表这个后台任务的进程,并且我们可以kill掉这个id来终止此次下载,第二段返回了一句话,意思是会将输出(持续)写入到wget-log这个文件。

2:查看wget后台进度

有几种方法可以查看:

-1:使用(断点续传)wget -c +正在执行的下载地址

root@8f9fbda9bb48 hadoop]# wget -c http://archive.apache.org/dist/hadoop/common/hadoop-2.8.0/hadoop-2.8.0.tar.gz
–2018-12-20 11:14:10– http://archive.apache.org/dist/hadoop/common/hadoop-2.8.0/hadoop-2.8.0.tar.gz
Resolving archive.apache.org (archive.apache.org)… 163.172.17.199
Connecting to archive.apache.org (archive.apache.org)|163.172.17.199|:80… connected.
HTTP request sent, awaiting response… 206 Partial Content
Length: 429928937 (410M), 353392307 (337M) remaining [application/x-gzip]
Saving to: ‘hadoop-2.8.0.tar.gz’

18% [++++++++++++++++++++++++++> ] 80,019,652 9.68KB/s eta 7h 51m
-2:找到下载文件的文件夹,其中那个正在写入的输出文件,使用

tail -f wget-log

[root@8f9fbda9bb48 hadoop]# tail -f wget-log
–2018-12-20 09:31:08– http://archive.apache.org/dist/hadoop/common/hadoop-2.8.0/hadoop-2.8.0.tar.gz
Resolving archive.apache.org (archive.apache.org)… 163.172.17.199
Connecting to archive.apache.org (archive.apache.org)|163.172.17.199|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 429928937 (410M) [application/x-gzip]
Saving to: ‘hadoop-2.8.0.tar.gz’

24% [===================================> ] 104,682,854 11.0KB/s eta 7h 24m
可以实时查看下载进度,ctrl + c 可退出。

也可使用

cat wget-log

root@8f9fbda9bb48 hadoop]# cat wget-log
–2018-12-20 09:31:08– http://archive.apache.org/dist/hadoop/common/hadoop-2.8.0/hadoop-2.8.0.tar.gz
Resolving archive.apache.org (archive.apache.org)… 163.172.17.199
Connecting to archive.apache.org (archive.apache.org)|163.172.17.199|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 429928937 (410M) [application/x-gzip]
Saving to: ‘hadoop-2.8.0.tar.gz’

20% [=============================> ] 87,723,878 8.44KB/s eta 7h 43m
来查看当前进度。
———————
版权声明:本文为CSDN博主「Java小学森」的原创文章,遵循CC 4.0 by-sa版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/wanglc7/article/details/85136418

转载请注明:phph5博客 » Linux:wget后台下载/查看后台任务进度