wget和curl的基本区别:
wget:将访问到的数据以文件的形式下载到本地。
curl:将访问到的内容直接打印到屏幕上。
下面通过命令演示,展示wget和curl命令的区别:
wget命令:
# 使用wget 访问192.168.178.132的web页面
[root@it test]# wget 192.168.178.132
--2023-10-16 14:15:26-- http://192.168.178.132/
Connecting to 192.168.178.132:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5 [text/html]
Saving to: ‘index.html’
100%[============================================================================================================>] 5 --.-K/s in 0s
# 将web页面的文件直接下载下来
2023-10-16 14:15:26 (403 KB/s) - ‘index.html’ saved [5/5]
[root@it test]# ls # 查看下载的文件index.html
index.html
[root@it test]# cat index.html # 查看index.html页面的内容
test
curl命令:
# curl直接将网页的内容加载出来。
[root@it test]# curl 192.168.178.132
test