首页
技术小册
AIGC
面试刷题
技术文章
MAGENTO
云计算
视频课程
源码下载
PDF书籍
「涨薪秘籍」
登录
注册
函数参数与返回值
传递变长参数
defer 和追踪
内置函数
递归函数
将函数作为参数
闭包
应用闭包:将函数作为返回值
使用闭包调试
计算函数执行时间
通过内存缓存来提升性能
声明和初始化
切片
For-range 结构
切片重组(reslice)
切片的复制与追加
字符串、数组和切片的应用
声明、初始化和 make
测试键值对是否存在及删除元素
for-range 的配套用法
map 类型的切片
map 的排序
将 map 的键值对调
标准库概述
regexp 包
锁和 sync 包
精密计算和 big 包
自定义包和可见性
为自定义包使用 godoc
使用 go install 安装自定义包
自定义包的目录结构、go install 和 go test
通过 Git 打包和安装
Go 的外部包和项目
在 Go 程序中使用外部库
结构体定义
使用工厂方法创建结构体实例
使用自定义包中的结构体
带标签的结构体
匿名字段和内嵌结构体
方法
类型的 String() 方法和格式化描述符
垃圾回收和 SetFinalizer
当前位置:
首页>>
技术小册>>
go编程权威指南(二)
小册名称:go编程权威指南(二)
**命令介绍** wget命令来自于英文词组”web get“的缩写,其功能是用于从指定网址下载网络文件。wget命令非常稳定,一般即便网络波动也不会导致下载失败,而是不断的尝试重连,直至整个文件下载完毕。 wget命令支持如HTTP、HTTPS、FTP等常见协议,可以在命令行中直接下载网络文件。 ------------ 常用参数: -V 显示版本信息 -h 显示帮助信息 -b 启动后转入后台执行 -c 支持断点续传 -O 定义本地文件名 -e <命令> 执行指定的命令 --limit-rate=<速率> 限制下载速度 ------------ 下载百度首页: ```bash wget https://www.baidu.com --2022-11-26 19:30:31-- https://www.baidu.com/ Resolving www.baidu.com (www.baidu.com)... 110.242.68.4, 110.242.68.3 Connecting to www.baidu.com (www.baidu.com)|110.242.68.4|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 2443 (2.4K) [text/html] Saving to: ‘index.html’ index.html 100%[=================================================>] 2.39K --.-KB/s in 0s 2022-11-26 19:30:31 (10.4 MB/s) - ‘index.html’ saved [2443/2443] ``` 下载指定的网络文件,并定义保存在本地的文件名称: ```bash u1@localhost:~/Documents$ wget -O downfile.txt http://192.168.31.101/test.txt --2022-11-26 19:31:43-- http://192.168.31.101/test.txt Connecting to 192.168.31.101:80... connected. HTTP request sent, awaiting response... 200 OK Length: 9 [text/plain] Saving to: ‘downfile.txt’ downfile.txt 100%[=================================================>] 9 --.-KB/s in 0s 2022-11-26 19:31:43 (1.54 MB/s) - ‘downfile.txt’ saved [9/9] u1@localhost:~/Documents$ ls downfile.txt index.html shellScript test.txt ``` 下载指定的网络文件,限速最高每秒300k: ```bash wget --limit-rate=1k https://www.baidu.com --2022-11-26 19:33:27-- https://www.baidu.com/ Resolving www.baidu.com (www.baidu.com)... 110.242.68.4, 110.242.68.3 Connecting to www.baidu.com (www.baidu.com)|110.242.68.4|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 2443 (2.4K) [text/html] Saving to: ‘index.html.1’ index.html.1 100%[=================================================>] 2.39K 1024 B/s in 2.4s 2022-11-26 19:33:30 (1024 B/s) - ‘index.html.1’ saved [2443/2443] ``` 启用断点续传技术下载指定的网络文件: ```bash u1@localhost:~/Documents$ wget -c https://www.baidu.com ``` 下载指定的网络文件,将任务放至后台执行: ```bash u1@localhost:~/Documents$ wget -b https://www.baidu.com Continuing in background, pid 3442. Output will be written to ‘wget-log’. u1@localhost:~/Documents$ ls downfile.txt index.html index.html.1 index.html.2 shellScript test.txt test.txt.1 wget-log u1@localhost:~/Documents$ cat wget-log --2022-11-26 19:34:39-- https://www.baidu.com/ Resolving www.baidu.com (www.baidu.com)... 110.242.68.3, 110.242.68.4 Connecting to www.baidu.com (www.baidu.com)|110.242.68.3|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 2443 (2.4K) [text/html] Saving to: ‘index.html.2’ 0K .. 100% 8.96M=0s 2022-11-26 19:34:39 (8.96 MB/s) - ‘index.html.2’ saved [2443/2443] ```
上一篇:
curl命令-文件传输工具
下一篇:
scp命令 – 文件上传下载
该分类下的相关小册推荐:
深入浅出Go语言核心编程(三)
Golang修炼指南
深入浅出Go语言核心编程(二)
Go Web编程(上)
Go Web编程(下)
Go-Web编程实战
Go开发权威指南(下)
GO面试指南
WebRTC音视频开发实战
Go 组件设计与实现
go编程权威指南(四)
Go开发基础入门