linux 系统中wget实现并行下载
2021/11/17 7:10:11
本文主要是介绍linux 系统中wget实现并行下载,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
(一)
1、测试
[root@centos79 test2]# ls source.txt [root@centos79 test2]# cat source.txt ## 首先准备了3个下载资源 https://s3.amazonaws.com/plink1-assets/plink_linux_x86_64_20210606.zip https://github.com/broadinstitute/gatk/releases/download/4.2.3.0/gatk-4.2.3.0.zip https://github.com/vcftools/vcftools/releases/download/v0.1.16/vcftools-0.1.16.tar.gz [root@centos79 test2]# cat source.txt | while read file; do wget $file & done ## 使用&符号放置后台运行 [root@centos79 test2]# --2021-11-16 22:41:42-- https://s3.amazonaws.com/plink1-assets/plink_linux_x86_64_20210606.zip --2021-11-16 22:41:42-- https://github.com/broadinstitute/gatk/releases/download/4.2.3.0/gatk-4.2.3.0.zip --2021-11-16 22:41:42-- https://github.com/vcftools/vcftools/releases/download/v0.1.16/vcftools-0.1.16.tar.gz Resolving s3.amazonaws.com (s3.amazonaws.com)... Resolving github.com (github.com)... Resolving github.com (github.com)... 52.217.193.224 Connecting to s3.amazonaws.com (s3.amazonaws.com)|52.217.193.224|:443... 20.205.243.166 Connecting to github.com (github.com)|20.205.243.166|:443... 20.205.243.166 Connecting to github.com (github.com)|20.205.243.166|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 8917076 (8.5M) [application/zip] Saving to: ‘plink_linux_x86_64_20210606.zip’ 31% [===========================> ] 2,793,696 318KB/s eta 33s connected.
2、测试后台进程 (进程都在)
[root@centos79 test2]# ps -aux | grep wget root 23060 0.2 0.2 152064 4764 pts/0 S 22:41 0:00 wget https://s3.amazonaws.com/plink1-assets/plink_linux_x86_64_20210606.zip root 23061 0.0 0.2 151932 4100 pts/0 S 22:41 0:00 wget https://github.com/broadinstitute/gatk/releases/download/4.2.3.0/gatk-4.2.3.0.zip root 23062 0.0 0.2 151932 4096 pts/0 S 22:41 0:00 wget https://github.com/vcftools/vcftools/releases/download/v0.1.16/vcftools-0.1.16.tar.gz root 23064 0.0 0.0 112808 960 pts/1 S+ 22:41 0:00 grep --color=auto wget
(二)
1、
[root@centos79 test2]# cat source.txt https://s3.amazonaws.com/plink1-assets/plink_linux_x86_64_20210606.zip https://github.com/broadinstitute/gatk/releases/download/4.2.3.0/gatk-4.2.3.0.zip https://github.com/vcftools/vcftools/releases/download/v0.1.16/vcftools-0.1.16.tar.gz [root@centos79 test2]# cat source.txt | while read file; do wget $file -b; done ## 加-b参数, fork到后台 Continuing in background, pid 23116. Output will be written to ‘wget-log’. Continuing in background, pid 23118. Output will be written to ‘wget-log.1’. Continuing in background, pid 23120. Output will be written to ‘wget-log.2’. [root@centos79 test2]#
2、查看进程 (进程都在)
[root@centos79 test2]# ps -aux | grep wget root 23116 0.2 0.2 152068 4136 ? Ss 22:45 0:00 wget https://s3.amazonaws.com/plink1-assets/plink_linux_x86_64_20210606.zip -b root 23118 24.9 0.2 152068 4244 ? Rs 22:45 0:02 wget https://github.com/broadinstitute/gatk/releases/download/4.2.3.0/gatk-4.2.3.0.zip -b root 23120 0.0 0.1 151936 3456 ? Ss 22:45 0:00 wget https://github.com/vcftools/vcftools/releases/download/v0.1.16/vcftools-0.1.16.tar.gz -b root 23122 0.0 0.0 112808 960 pts/1 S+ 22:45 0:00 grep --color=auto wget
(三)
1、
[root@centos79 test2]# ls source.txt [root@centos79 test2]# cat source.txt https://s3.amazonaws.com/plink1-assets/plink_linux_x86_64_20210606.zip https://github.com/broadinstitute/gatk/releases/download/4.2.3.0/gatk-4.2.3.0.zip https://github.com/vcftools/vcftools/releases/download/v0.1.16/vcftools-0.1.16.tar.gz [root@centos79 test2]# cat source.txt | xargs -n 1 -P 2 wget -q
2、查看进程
[root@centos79 test2]# ps -aux | grep wget root 23231 0.0 0.0 108352 616 pts/0 S+ 22:51 0:00 xargs -n 1 -P 2 wget -q root 23232 0.0 0.2 152064 4768 pts/0 S+ 22:51 0:00 wget -q https://s3.amazonaws.com/plink1-assets/plink_linux_x86_64_20210606.zip root 23233 0.0 0.2 151932 4100 pts/0 S+ 22:51 0:00 wget -q https://github.com/broadinstitute/gatk/releases/download/4.2.3.0/gatk-4.2.3.0.zip root 23243 0.0 0.0 112808 960 pts/1 S+ 22:51 0:00 grep --color=auto wget
这篇关于linux 系统中wget实现并行下载的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-12如何创建可引导的 ESXi USB 安装介质 (macOS, Linux, Windows)
- 2024-11-08linux的 vi编辑器中搜索关键字有哪些常用的命令和技巧?-icode9专业技术文章分享
- 2024-11-08在 Linux 的 vi 或 vim 编辑器中什么命令可以直接跳到文件的结尾?-icode9专业技术文章分享
- 2024-10-22原生鸿蒙操作系统HarmonyOS NEXT(HarmonyOS 5)正式发布
- 2024-10-18操作系统入门教程:新手必看的基本操作指南
- 2024-10-18初学者必看:操作系统入门全攻略
- 2024-10-17操作系统入门教程:轻松掌握操作系统基础知识
- 2024-09-11Linux部署Scrapy学习:入门级指南
- 2024-09-11Linux部署Scrapy:入门级指南
- 2024-08-21【Linux】分区向左扩容的方法