curl - transfer a URL

curl

SYNOPSIS

curl [options] [URL...]

DESCRIPTION

curl is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP,SCP, SFTP, SMTP, SMTPS, TELNET and TFTP).

The command is designed to work without user interaction.

curl offers a busload of useful tricks like proxy support, user authentication, FTP upload, HTTP post, SSL connections, cookies, file transfer resume, Metalink, and more.

curl is powered by libcurl for all transfer-related features. See libcurl(3) for details.

Wget - The non-interactive network downloader.

wget

SYNOPSIS

wget [option]... [URL]...

DESCRIPTION

GNU Wget is a free utility for non-interactive download of files from the Web.

It supports HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies.

Wget is non-interactive, meaning that it can work in the background, while the user is not logged on.

This allows you to start a retrieval and disconnect from the system, letting Wget finish the work.

By contrast, most of the Web browsers require constant user's presence, which can be a great hindrance when transferring a lot of data.

Wget can follow links in HTML, XHTML, and CSS pages, to create local versions of remote web sites, fully recreating the directory structure of the original site.

This is sometimes referred to as "recursive downloading." While doing that, Wget respects the Robot Exclusion Standard (/robots.txt).

Wget can be instructed to convert the links in downloaded files to point at the local files, for offline viewing.

Wget has been designed for robustness over slow or unstable network connections; if a download fails due to a network problem, it will keep retrying until the whole file has been retrieved.

If the server supports regetting, it will instruct the server to continue the download from where it left off.

区别

curl wget
简述 主要作为调试工具 主要作为下载工具
特点 由libcurl库支持,可模拟web请求,测试API,支持协议众多,支持下载 命令行命令,使用简洁,支持递归和断点
缺点 拼接复杂请求麻烦;下载需要额外参数 不支持并发、p2p、磁力链接等

代理设置

临时方式

  • 使用命令时指定代理

    curl -x "http://10.144.1.10:8080" www.baidu.com

    wget -c "http_proxy=10.144.1.10:8080" http://mirrors.sohu.com/python/2.7.12/Python-2.7.12.tgz

  • 更改当前终端的环境变量

    一般的linux程序都是使用http_proxy和ftp_proxy这两个环境变量来获得代理设置的。

    声明环境变量export http_proxy=proxy_addr:port就可以在这个shell界面直接使用命令了。

    例如:export http_proxy=10.144.1.10:8080

永久方式

在配置文件/etc/wgetrc中添加如下内容:

# You can set the default proxies for Wget to use for http and ftp.
# They will override the value in the environment.
http_proxy = http://10.144.1.10:8080/
https_proxy = http://10.144.1.10:8080/
#ftp_proxy = http://proxy.yoyodyne.com:18023/ # If you do not want to use proxy at all, set this to off.
use_proxy = yes

Linux - curl和Wget的更多相关文章

  1. Linux学习:curl 与 wget命令

    curl和wget命令都是Linux下的工具,可以用来下载文件. 一.wget 例1: wget http://www.minjieren.com/wordpress-3.1-zh_CN.zip 下载 ...

  2. linux下载利器之curl和wget的区别

    linux下载利器-------curl和wget的区别 curl和wget基础功能有诸多重叠,如下载等. 在高级用途上的curl由于可自定义各种请求参数所以长于模拟web请求,用于测试网页交互(浏览 ...

  3. Linux命令发送Http的get或post请求(curl和wget两种方法)

    Http请求指的是客户端向服务器的请求消息,Http请求主要分为get或post两种,在Linux系统下可以用curl和wget命令来模拟Http的请求.下面就来介绍一下Linux系统如何模拟Http ...

  4. 简单备忘一下Linux下的wget和curl如何使用http proxy

    简单备忘一下Linux下的wget和curl如何使用http proxywget -e "http_proxy=porxyhost:port" www.baidu.comcurl ...

  5. linux包-下载-curl与wget

    [root@localhost ~]# rpm -qa|grep curllibcurl-7.19.7-37.el6_4.x86_64python-pycurl-7.19.0-8.el6.x86_64 ...

  6. Shell curl 和 wget 使用代理IP

    Linux Shell 提供两个非常实用的命令来爬取网页,它们分别是 curl 和 wget curl 和 wget 使用代理 curl 支持 http.https.socks4.socks5 wge ...

  7. Linux Curl命令

    一.简介 linux curl是一个利用URL规则在命令行下工作的文件传输工具.它支持文件的上传和下载,所以是综合传输工具,但按传统,习惯称url为下载工具.   二.安装 wget http://c ...

  8. curl 与wget的区别

    CURL与wget的区别 当想要直接通过linux 命令行下载文件,马上就能想到两个工具:wget 和 CURL.它们有很多一样的特征,可以很轻易的完成一些相同的任务,虽然它们有一些相似的特征,但它们 ...

  9. (转)Linux curl命令参数详解

    Linux curl命令参数详解 命令:curl在Linux中curl是一个利用URL规则在命令行下工作的文件传输工具,可以说是一款很强大的http命令行工具.它支持文件的上传和下载,是综合传输工具, ...

随机推荐

  1. 理解SqlMapConfig.xml文件

    SqlMapConfig.xml mybatis的全局配置文件SqlMapConfig.xml,配置内容如下: properties(属性) settings(全局配置参数) typeAliases( ...

  2. Mybayis的项目使用的Mapping文件使用总结参考(一)

    作者:longgangbai 以前用过ibatis2,但是听说ibatis3有较大的性能提升,而且设计也更合理,他不兼容ibatis2.尽管ibatis3还是beta10的状态,但还是打算直接使用ib ...

  3. Hive中遇到全角

    今天在梳理银行SQL业务的时候出现了一个全角的问题:两个种代码 都可以 使用了UDF函数解决 package 广发; import org.apache.hadoop.hive.ql.exec.Des ...

  4. struts2之登陆拦截

    针对登录拦截功能,我们需要设置拦截哪些方法和不拦截哪些方法 action action类中,处理登录时,将用户.密码绑定到session ActionContext ac = ActionContex ...

  5. Java数据库小项目02--管家婆项目

    目录 项目要求 开发环境搭建 工具类JDBCUtils 创建管家婆数据表 项目分层 MainApp层 MainView层 ZhangWuController层 ZhangWuService层 Zhan ...

  6. mobx是什么?有什么优点?

    mobx是一个简单可扩展的状态管理库. mobx vs redux mobx是学习成本更低,性能更好的状态解决方案. mobx开发难度低: mobx代码量少: mobx渲染性能好: mobx参考

  7. 几个不同的关键XPath概念

    几个不同的关键XPath概念...... 绝对vs相对XPath(/vs .) / 引入绝对位置路径,从文档的根开始. . 从上下文节点开始引入相对位置路径. 命名元素vs任何元素(enamevs * ...

  8. 小米oj 帮小学生排队(排序+插入)

     帮小学生排队 序号:#18难度:有挑战时间限制:1000ms内存限制:10M 描述 用一个数组表示一群正在排队的小学生,每个小学生用一对整数 H, K 来表示:H 表示这个小学生的身高,K 表示这个 ...

  9. selenium-爬取小说

    selenium-爬取小说 1 import requests 2 from bs4 import BeautifulSoup 3 import sys 4 from selenium import ...

  10. codeforces#999 E. Reachability from the Capital(图论加边)

    题目链接: https://codeforces.com/contest/999/problem/E 题意: 在有向图中加边,让$S$点可以到达所有点 数据范围: $ 1 \leq n \leq 50 ...